aboutsummaryrefslogtreecommitdiff
path: root/module/zfs/vdev_removal.c
diff options
context:
space:
mode:
authorGeorge Amanakis <gamanakis@gmail.com>2020-06-09 17:15:08 +0000
committerGitHub <noreply@github.com>2020-06-09 17:15:08 +0000
commitb7654bd7940618f1b02835d565e04920c8c4403f (patch)
treea346410e1da29cedeb9663447a59abf2dd4844ec /module/zfs/vdev_removal.c
parent32f26eaa70fe9e8aea79311123879f885f674d45 (diff)
downloadsrc-b7654bd7940618f1b02835d565e04920c8c4403f.tar.gz
src-b7654bd7940618f1b02835d565e04920c8c4403f.zip
Diffstat (limited to 'module/zfs/vdev_removal.c')
-rw-r--r--module/zfs/vdev_removal.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/module/zfs/vdev_removal.c b/module/zfs/vdev_removal.c
index 3f4f9091f43d..56e420871f61 100644
--- a/module/zfs/vdev_removal.c
+++ b/module/zfs/vdev_removal.c
@@ -2224,6 +2224,20 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare)
* Cache devices can always be removed.
*/
vd = spa_lookup_by_guid(spa, guid, B_TRUE);
+
+ /*
+ * Stop trimming the cache device. We need to release the
+ * config lock to allow the syncing of TRIM transactions
+ * without releasing the spa_namespace_lock. The same
+ * strategy is employed in spa_vdev_remove_top().
+ */
+ spa_vdev_config_exit(spa, NULL,
+ txg + TXG_CONCURRENT_STATES + TXG_DEFER_SIZE, 0, FTAG);
+ mutex_enter(&vd->vdev_trim_lock);
+ vdev_trim_stop(vd, VDEV_TRIM_CANCELED, NULL);
+ mutex_exit(&vd->vdev_trim_lock);
+ txg = spa_vdev_config_enter(spa);
+
ev = spa_event_create(spa, vd, NULL, ESC_ZFS_VDEV_REMOVE_AUX);
spa_vdev_remove_aux(spa->spa_l2cache.sav_config,
ZPOOL_CONFIG_L2CACHE, l2cache, nl2cache, nv);