]> granicus.if.org Git - zfs/commitdiff
Fix incorrect spare vdev state after replacing
authorIsaac Huang <he.huang@intel.com>
Thu, 23 Feb 2017 18:32:15 +0000 (11:32 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 23 Feb 2017 18:32:15 +0000 (10:32 -0800)
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 <mail@gmelikov.ru>
Reviewed-by: Don Brady <don.brady@intel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Isaac Huang <he.huang@intel.com>
Closes #5766
Closes #5770

module/zfs/spa.c

index a69b8cda81c9520e4036256476a8fe23236b6c34..d632d635e9160b67aacfad8f69b335ac42b90a96 100644 (file)
@@ -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);