From 6d82f98c3d9f83045a801df60f904421b101faa9 Mon Sep 17 00:00:00 2001 From: Isaac Huang Date: Thu, 23 Feb 2017 11:32:15 -0700 Subject: 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 Reviewed-by: Don Brady Reviewed-by: Brian Behlendorf Signed-off-by: Isaac Huang Closes #5766 Closes #5770 --- module/zfs/spa.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'module/zfs/spa.c') 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); -- cgit v1.2.3