]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Fix incorrect pool state after import
authorGeLiXin <ge.lixin@zte.com.cn>
Tue, 9 Aug 2016 09:49:51 +0000 (17:49 +0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 12 Aug 2016 20:46:51 +0000 (13:46 -0700)
Import a raidz pool which has a vdev with a bad label, zpool status
shows the right state of the dev, but the wrong state of the pool.
The pool state should be DEGRADED, not ONLINE.

We examine the label in vdev_validate while in spa_load_impl, the bad
label can be detected but doesn't propagate its state to the parent.
There are other chances to propagate state in the following vdev_load
if we failed to load DTL, but our pool is raidz1 which can tolerate a
faulted disk.  So we lost the last chance to correct the pool state.

Propagate the leaf vdev's state to parent if its label was corrupted,
as is done elsewhere in vdev_validate.

Signed-off-by: GeLiXin <ge.lixin@zte.com.cn>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Don Brady <don.brady@intel.com>
Closes #4948

module/zfs/vdev.c

index d0b45864214bdce2f2af462ba70c60bb53b2b8df..75f6e5ce11ae570b564c7f2174caff2be76b73c9 100644 (file)
@@ -1423,7 +1423,7 @@ vdev_validate(vdev_t *vd, boolean_t strict)
                    spa_last_synced_txg(spa) : -1ULL;
 
                if ((label = vdev_label_read_config(vd, txg)) == NULL) {
-                       vdev_set_state(vd, B_TRUE, VDEV_STATE_CANT_OPEN,
+                       vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN,
                            VDEV_AUX_BAD_LABEL);
                        return (0);
                }