From 975a13259b87572c39d8467f1f4a31869d0abc84 Mon Sep 17 00:00:00 2001 From: Don Brady Date: Thu, 2 May 2024 19:28:10 +0000 Subject: Add support for parallel pool exports Changed spa_export_common() such that it no longer holds the spa_namespace_lock for the entire duration and instead sets spa_export_thread to indicate an import is in progress on the spa. This allows for an export to a diffent pool to proceed in parallel while an export is still processing potentially long operations like spa_unload_log_sm_flush_all(). Calls like spa_lookup() and spa_vdev_enter() that rely on the spa_namespace_lock to serialize them against a concurrent export, now wait for any in-progress export thread to complete before proceeding. The 'zpool import -a' sub-command also provides multi-threaded support, using a thread pool to submit the exports in parallel. Sponsored-By: Klara Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf Reviewed-by: George Wilson Signed-off-by: Don Brady Closes #16153 --- module/zfs/vdev_rebuild.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'module/zfs/vdev_rebuild.c') diff --git a/module/zfs/vdev_rebuild.c b/module/zfs/vdev_rebuild.c index 00ebd4c9f..8a8b02cab 100644 --- a/module/zfs/vdev_rebuild.c +++ b/module/zfs/vdev_rebuild.c @@ -1087,7 +1087,8 @@ vdev_rebuild_stop_wait(vdev_t *vd) { spa_t *spa = vd->vdev_spa; - ASSERT(MUTEX_HELD(&spa_namespace_lock)); + ASSERT(MUTEX_HELD(&spa_namespace_lock) || + spa->spa_export_thread == curthread); if (vd == spa->spa_root_vdev) { for (uint64_t i = 0; i < vd->vdev_children; i++) -- cgit v1.2.3