Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: incorrect pool state after import #4948

Closed
wants to merge 1 commit into from
Closed

Conversation

GeLiXin
Copy link
Contributor

@GeLiXin GeLiXin commented Aug 9, 2016

The issue:
Import a raidz pool which have a vdev of bad label, zpool status shows a right state of vdev, but wrong state of pool. The pool state should be DEGRADED, not ONLINE.

pool: gpool
state: ONLINE
status: One or more devices could not be used because the label is missing or
invalid. Sufficient replicas exist for the pool to continue
functioning in a degraded state.
action: Replace the device using 'zpool replace'.
see: http://zfsonlinux.org/msg/ZFS-8000-4J
scan: none requested
config:

    NAME                     STATE     READ WRITE CKSUM
    gpool                    ONLINE       0     0     0
      raidz1-0               ONLINE       0     0     0
        /home/glx/disk1      ONLINE       0     0     0
        6507082734343245157  UNAVAIL      0     0     0  was /home/glx/disk2
        /home/glx/disk3      ONLINE       0     0     0
        /home/glx/disk4      ONLINE       0     0     0

errors: No known data errors

The way to reproduce:
1、for i in {1..4};do dd if=/dev/zero of=/home/glx/disk$i bs=1M count=100;done
2、zpool create gpool raidz1 /home/glx/disk1 /home/glx/disk2 /home/glx/disk3 /home/glx/disk4 -f
3、zpool export gpool
4、dd if=/dev/zero of=/home/glx/disk2 bs=1M count=100
5、zpool import -d /home/glx gpool
6、zpool status gpool

Analysis:
We examine the label in vdev_validate while spa_load_impl, bad label can be detacted but didn't propagate it's state to parent.
There are other chance to propagate state in the following vdev_load if we failed to load DTL, but our pool is raidz1 which can tolerate a fault disk , so we lost the last chance to correct the pool state.

Solution:
Propagate the leaf vdev's state to parent if it's label was corrupted.
The other way is use different propagate strategy between caller of spa_load_impl and vdev_reopen, which is logically more reasonable but seems not enough necessity?

The issue:
Import a raidz pool which have a vdev of bad label, zpool status shows a right state of vdev, but wrong state of pool.
the pool state should be DEGRADED, not ONLINE.

Analysis:
We examine the label in vdev_validate while spa_load_impl, bad label can be detacted but didn't propagate it's state to parent.
There are other chance to propagate state in the following vdev_load if we failed to load DTL, but our pool is raidz1 which can tolerate a
fault disk , so we lost the last chance to correct the pool state.

Solution:
Propagate the leaf vdev's state to parent if it's label was corrupted.
The other way is use different propagate strategy between caller of spa_load_impl and vdev_reopen, which is logically more reasonable but seems not enough necessity.
@behlendorf behlendorf added this to the 0.7.0 milestone Aug 9, 2016
@behlendorf
Copy link
Contributor

Nice, this LGTM. The same propagation strategy is already used for several of the other sanity checks in vdev_validate(). Unfortunately, I don't see why this check wasn't updated like the others. This code is quite old dating back to the original 2006 implementation.

@don-brady
Copy link
Contributor

LGTM.

nedbass pushed a commit to nedbass/zfs that referenced this pull request Sep 3, 2016
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 openzfs#4948
nedbass pushed a commit to nedbass/zfs that referenced this pull request Sep 5, 2016
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 openzfs#4948
nedbass pushed a commit to nedbass/zfs that referenced this pull request Sep 5, 2016
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 openzfs#4948
tuxoko pushed a commit to tuxoko/zfs that referenced this pull request Sep 8, 2016
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 openzfs#4948
nedbass pushed a commit to nedbass/zfs that referenced this pull request Sep 9, 2016
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 openzfs#4948
nedbass pushed a commit to nedbass/zfs that referenced this pull request Sep 9, 2016
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 openzfs#4948
DeHackEd pushed a commit to DeHackEd/zfs that referenced this pull request Oct 19, 2016
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 openzfs#4948
DeHackEd pushed a commit to DeHackEd/zfs that referenced this pull request Oct 29, 2016
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 openzfs#4948
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants