HomeFreeBSD

Fix 'zpool add' handling of nested interior VDEVs

Description

Fix 'zpool add' handling of nested interior VDEVs

When replacing a faulted device which was previously handled by a spare
multiple levels of nested interior VDEVs will be present in the pool
configuration; the following example illustrates one of the possible
situations:

   NAME                          STATE     READ WRITE CKSUM
   testpool                      DEGRADED     0     0     0
     raidz1-0                    DEGRADED     0     0     0
       spare-0                   DEGRADED     0     0     0
         replacing-0             DEGRADED     0     0     0
           /var/tmp/fault-dev    UNAVAIL      0     0     0  cannot open
           /var/tmp/replace-dev  ONLINE       0     0     0
         /var/tmp/spare-dev1     ONLINE       0     0     0
       /var/tmp/safe-dev         ONLINE       0     0     0
   spares
     /var/tmp/spare-dev1         INUSE     currently in use

This is safe and allowed, but get_replication() needs to handle this
situation gracefully to let zpool add new devices to the pool.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #6678
Closes #6996

Details

Provenance
LOLi <loli10K@users.noreply.github.com>Authored on Dec 28 2017, 6:15 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Dec 28 2017, 6:15 PM
Parents
rG2fe61a7ecc50: OpenZFS 8909 - 8585 can cause a use-after-free kernel panic
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG390d679acdfa: Fix 'zpool add' handling of nested interior VDEVs (authored by LOLi <loli10K@users.noreply.github.com>).Dec 28 2017, 6:15 PM