summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/fs/zfs/spa_misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/uts/common/fs/zfs/spa_misc.c')
-rw-r--r--usr/src/uts/common/fs/zfs/spa_misc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr/src/uts/common/fs/zfs/spa_misc.c b/usr/src/uts/common/fs/zfs/spa_misc.c
index 3e51849766..c08c58cffe 100644
--- a/usr/src/uts/common/fs/zfs/spa_misc.c
+++ b/usr/src/uts/common/fs/zfs/spa_misc.c
@@ -590,13 +590,15 @@ spa_config_held(spa_t *spa, krw_t rw)
uint64_t
spa_vdev_enter(spa_t *spa)
{
+ mutex_enter(&spa_namespace_lock);
+
/*
- * Suspend scrub activity while we mess with the config.
+ * Suspend scrub activity while we mess with the config. We must do
+ * this after acquiring the namespace lock to avoid a 3-way deadlock
+ * with spa_scrub_stop() and the scrub thread.
*/
spa_scrub_suspend(spa);
- mutex_enter(&spa_namespace_lock);
-
spa_config_enter(spa, RW_WRITER, spa);
return (spa_last_synced_txg(spa) + 1);