mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-18 10:21:01 +03:00
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 <igor@dilos.org> Reviewed-by: Kjeld Schouten <kjeld@schouten-lebbing.nl> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #8602 Closes #9751
This commit is contained in:
parent
421f8a2be0
commit
bb04f9c195
@ -1861,6 +1861,13 @@ spa_vdev_remove_log(vdev_t *vd, uint64_t *txg)
|
|||||||
spa_vdev_config_exit(spa, NULL,
|
spa_vdev_config_exit(spa, NULL,
|
||||||
*txg + TXG_CONCURRENT_STATES + TXG_DEFER_SIZE, 0, FTAG);
|
*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
|
* Evacuate the device. We don't hold the config lock as
|
||||||
* writer since we need to do I/O but we do keep the
|
* writer since we need to do I/O but we do keep the
|
||||||
@ -1891,12 +1898,6 @@ spa_vdev_remove_log(vdev_t *vd, uint64_t *txg)
|
|||||||
vdev_metaslab_fini(vd);
|
vdev_metaslab_fini(vd);
|
||||||
|
|
||||||
spa_vdev_config_exit(spa, NULL, *txg, 0, FTAG);
|
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);
|
*txg = spa_vdev_config_enter(spa);
|
||||||
|
|
||||||
sysevent_t *ev = spa_event_create(spa, vd, NULL,
|
sysevent_t *ev = spa_event_create(spa, vd, NULL,
|
||||||
|
Loading…
Reference in New Issue
Block a user