summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2019-12-26 10:50:23 -0800
committerGitHub <[email protected]>2019-12-26 10:50:23 -0800
commit635a01aafdd7191e32cd1228e96dc90ddfe0d899 (patch)
treecda9aef5e07bac69bde9548f2fc3c6081ed506d6 /module
parent80bde2c4ba3720526bb344b4532db98c073cd6bd (diff)
Cancel initialize and TRIM before vdev_metaslab_fini()
Any running 'zpool initialize' or TRIM must be cancelled prior to the vdev_metaslab_fini() call in spa_vdev_remove_log() which will unload the metaslabs and set ms->ms_group == NULL. Reviewed-by: Igor Kozhukhov <[email protected]> Reviewed-by: Kjeld Schouten <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #8602 Closes #9751
Diffstat (limited to 'module')
-rw-r--r--module/zfs/vdev_removal.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/module/zfs/vdev_removal.c b/module/zfs/vdev_removal.c
index 614f70efc..dee46f4b3 100644
--- a/module/zfs/vdev_removal.c
+++ b/module/zfs/vdev_removal.c
@@ -1871,6 +1871,13 @@ spa_vdev_remove_log(vdev_t *vd, uint64_t *txg)
*txg + TXG_CONCURRENT_STATES + TXG_DEFER_SIZE, 0, FTAG);
/*
+ * Cancel any initialize or TRIM which was in progress.
+ */
+ vdev_initialize_stop_all(vd, VDEV_INITIALIZE_CANCELED);
+ vdev_trim_stop_all(vd, VDEV_TRIM_CANCELED);
+ vdev_autotrim_stop_wait(vd);
+
+ /*
* Evacuate the device. We don't hold the config lock as
* writer since we need to do I/O but we do keep the
* spa_namespace_lock held. Once this completes the device
@@ -1921,12 +1928,6 @@ spa_vdev_remove_log(vdev_t *vd, uint64_t *txg)
spa_log_sm_set_blocklimit(spa);
spa_vdev_config_exit(spa, NULL, *txg, 0, FTAG);
-
- /* Stop initializing and TRIM */
- vdev_initialize_stop_all(vd, VDEV_INITIALIZE_CANCELED);
- vdev_trim_stop_all(vd, VDEV_TRIM_CANCELED);
- vdev_autotrim_stop_wait(vd);
-
*txg = spa_vdev_config_enter(spa);
sysevent_t *ev = spa_event_create(spa, vd, NULL,