Print this page
6386 Fix function call with uninitialized value in vdev_inuse
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/vdev_label.c
          +++ new/usr/src/uts/common/fs/zfs/vdev_label.c
↓ open down ↓ 588 lines elided ↑ open up ↑
 589  589           * Check to see if this is an l2cache device.
 590  590           */
 591  591          if (spa_l2cache_exists(device_guid, NULL))
 592  592                  return (B_TRUE);
 593  593  
 594  594          /*
 595  595           * We can't rely on a pool's state if it's been imported
 596  596           * read-only.  Instead we look to see if the pools is marked
 597  597           * read-only in the namespace and set the state to active.
 598  598           */
 599      -        if ((spa = spa_by_guid(pool_guid, device_guid)) != NULL &&
      599 +        if (state != POOL_STATE_SPARE && state != POOL_STATE_L2CACHE &&
      600 +            (spa = spa_by_guid(pool_guid, device_guid)) != NULL &&
 600  601              spa_mode(spa) == FREAD)
 601  602                  state = POOL_STATE_ACTIVE;
 602  603  
 603  604          /*
 604  605           * If the device is marked ACTIVE, then this device is in use by another
 605  606           * pool on the system.
 606  607           */
 607  608          return (state == POOL_STATE_ACTIVE);
 608  609  }
 609  610  
↓ open down ↓ 662 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX