aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorPaul Dagnelie <[email protected]>2022-05-25 09:25:13 -0700
committerGitHub <[email protected]>2022-05-25 09:25:13 -0700
commit7829b465a7f736e9458257fcb9dcefd8eb882ee0 (patch)
treea23f0c052c3203777afa7cd679da4c8a97f6a631 /module/zfs
parentb37093a188d94279e5e2faaf09e6ff754873b0a2 (diff)
Cancel in-progress rebuilds when we finish removal
This issue was discovered by zloop runs. When a mirror or other redundant top-level vdev has a disk failure, and the disk is replaced, the rebuild process occurs. A removal can happen while this is in progress. If the removal completes before the rebuild does, the removal process will try to free the vdev that is still in use. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Paul Dagnelie <[email protected]> Closes #13498
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/vdev_removal.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/module/zfs/vdev_removal.c b/module/zfs/vdev_removal.c
index 5508d2737..7dfc4345f 100644
--- a/module/zfs/vdev_removal.c
+++ b/module/zfs/vdev_removal.c
@@ -1364,6 +1364,8 @@ vdev_remove_complete(spa_t *spa)
ASSERT3P(vd->vdev_initialize_thread, ==, NULL);
ASSERT3P(vd->vdev_trim_thread, ==, NULL);
ASSERT3P(vd->vdev_autotrim_thread, ==, NULL);
+ vdev_rebuild_stop_wait(vd);
+ ASSERT3P(vd->vdev_rebuild_thread, ==, NULL);
uint64_t vdev_space = spa_deflate(spa) ?
vd->vdev_stat.vs_dspace : vd->vdev_stat.vs_space;