diff --git a/module/zfs/vdev_rebuild.c b/module/zfs/vdev_rebuild.c index fdb8ad97b439..b759e64d23ad 100644 --- a/module/zfs/vdev_rebuild.c +++ b/module/zfs/vdev_rebuild.c @@ -22,6 +22,7 @@ * * Copyright (c) 2018, Intel Corporation. * Copyright (c) 2020 by Lawrence Livermore National Security, LLC. + * Copyright (c) 2022 Hewlett Packard Enterprise Development LP. */ #include @@ -134,6 +135,7 @@ static int zfs_rebuild_scrub_enabled = 1; * For vdev_rebuild_initiate_sync() and vdev_rebuild_reset_sync(). */ static __attribute__((noreturn)) void vdev_rebuild_thread(void *arg); +static void vdev_rebuild_reset_sync(void *arg, dmu_tx_t *tx); /* * Clear the per-vdev rebuild bytes value for a vdev tree. @@ -307,6 +309,15 @@ vdev_rebuild_complete_sync(void *arg, dmu_tx_t *tx) vdev_rebuild_phys_t *vrp = &vr->vr_rebuild_phys; mutex_enter(&vd->vdev_rebuild_lock); + + /* Handle the lost reset wanted signal */ + if (vd->vdev_rebuild_reset_wanted) { + dsl_sync_task_nowait(spa_get_dsl(spa), vdev_rebuild_reset_sync, + (void *)(uintptr_t)vd->vdev_id, tx); + mutex_exit(&vd->vdev_rebuild_lock); + return; + } + vrp->vrp_rebuild_state = VDEV_REBUILD_COMPLETE; vrp->vrp_end_time = gethrestime_sec();