aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIsaac Huang <[email protected]>2017-02-23 11:32:15 -0700
committerBrian Behlendorf <[email protected]>2017-02-23 10:32:15 -0800
commit6d82f98c3d9f83045a801df60f904421b101faa9 (patch)
tree17917e3b6ac099b2eeb7c6b267bed63260dead19
parent100790a8dd7c7cbbcf35871d7361429e2ae09435 (diff)
Fix incorrect spare vdev state after replacing
After a hot spare replaces an OFFLINE vdev, the new parent spare vdev state is set incorrectly to OFFLINE. The correct state should be DEGRADED. The incorrect OFFLINE state will prevent top-level vdev from reading the spare vdev, thus causing unnecessary reconstruction. Reviewed-by: George Melikov <[email protected]> Reviewed-by: Don Brady <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Isaac Huang <[email protected]> Closes #5766 Closes #5770
-rw-r--r--module/zfs/spa.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/module/zfs/spa.c b/module/zfs/spa.c
index a69b8cda8..d632d635e 100644
--- a/module/zfs/spa.c
+++ b/module/zfs/spa.c
@@ -4713,6 +4713,11 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing)
newvd->vdev_crtxg = oldvd->vdev_crtxg;
vdev_add_child(pvd, newvd);
+ /*
+ * Reevaluate the parent vdev state.
+ */
+ vdev_propagate_state(pvd);
+
tvd = newvd->vdev_top;
ASSERT(pvd->vdev_top == tvd);
ASSERT(tvd->vdev_parent == rvd);