summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Ahrens <[email protected]>2017-05-10 10:32:40 -0700
committerTony Hutter <[email protected]>2017-06-09 14:05:15 -0700
commit1e5f75ecbe745640c4a4ba85dfe4f36364fa706f (patch)
treee2ae0f8a7ed2b52a5b839e48fb712b5ff0d31736
parent36ccb9db43843c67ee3c7aa0e175bd96a0ccc8e3 (diff)
OpenZFS 8166 - zpool scrub thinks it repaired offline device
Authored by: Matthew Ahrens <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed-by: loli10K <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: Matthew Ahrens <[email protected]> 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". OpenZFS-issue: https://www.illumos.org/issues/8166 OpenZFS-commit: https://github.com/openzfs/openzfs/pull/372 Closes #5806 Closes #6103
-rw-r--r--module/zfs/vdev.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c
index 7d814a63b..8095b6177 100644
--- a/module/zfs/vdev.c
+++ b/module/zfs/vdev.c
@@ -1799,6 +1799,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);