summaryrefslogtreecommitdiffstats
path: root/sys/cddl
diff options
context:
space:
mode:
authorgjb <gjb@FreeBSD.org>2017-06-06 14:46:23 +0000
committergjb <gjb@FreeBSD.org>2017-06-06 14:46:23 +0000
commit31b2f672ba293b196e4099c7320d06141d063517 (patch)
tree50fbf0f081a05489afd9125148181769ef3f47c8 /sys/cddl
parent8a46c839a03f0f728734d8830e25da1dfbe4b49c (diff)
downloadFreeBSD-src-31b2f672ba293b196e4099c7320d06141d063517.zip
FreeBSD-src-31b2f672ba293b196e4099c7320d06141d063517.tar.gz
MFC r318943 (avg):
MFV r318942: 8166 zpool scrub thinks it repaired offline device https://www.illumos.org/issues/8166 If we do a scrub while a leaf device is offline (via "zpool offline"), we will inadvertently clear the DTL (dirty time log) of the offline device, even though it is still damaged. When the device comes back online, we will incompletely resilver it, thinking that the scrub repaired blocks written before the scrub was started. The incomplete resilver can lead to data loss if there is a subsequent failure of a different leaf device. The fix is to never clear the DTL of offline devices. Note that if a device is onlined while a scrub is in progress, the scrub will be restarted. The problem can be worked around by running "zpool scrub" after "zpool online". See also https://github.com/zfsonlinux/zfs/issues/5806 PR: 219537 Approved by: re (kib) Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/cddl')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
index 9df0019..bf264e6 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
@@ -1929,6 +1929,9 @@ vdev_dtl_should_excise(vdev_t *vd)
ASSERT0(scn->scn_phys.scn_errors);
ASSERT0(vd->vdev_children);
+ if (vd->vdev_state < VDEV_STATE_DEGRADED)
+ return (B_FALSE);
+
if (vd->vdev_resilver_txg == 0 ||
range_tree_space(vd->vdev_dtl[DTL_MISSING]) == 0)
return (B_TRUE);
OpenPOWER on IntegriCloud