summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sys/zfs_vfsops.h1
-rw-r--r--module/zfs/zpl_super.c11
2 files changed, 11 insertions, 1 deletions
diff --git a/include/sys/zfs_vfsops.h b/include/sys/zfs_vfsops.h
index febfdff97..31c9c6d7f 100644
--- a/include/sys/zfs_vfsops.h
+++ b/include/sys/zfs_vfsops.h
@@ -32,6 +32,7 @@
#include <sys/zil.h>
#include <sys/sa.h>
#include <sys/rrwlock.h>
+#include <sys/dsl_dataset.h>
#include <sys/zfs_ioctl.h>
#ifdef __cplusplus
diff --git a/module/zfs/zpl_super.c b/module/zfs/zpl_super.c
index fc10271b7..5c426b0a9 100644
--- a/module/zfs/zpl_super.c
+++ b/module/zfs/zpl_super.c
@@ -271,8 +271,17 @@ zpl_mount_impl(struct file_system_type *fs_type, int flags, zfs_mnt_t *zm)
if (err)
return (ERR_PTR(-err));
+ /*
+ * The dsl pool lock must be released prior to calling sget().
+ * It is possible sget() may block on the lock in grab_super()
+ * while deactivate_super() holds that same lock and waits for
+ * a txg sync. If the dsl_pool lock is held over over sget()
+ * this can prevent the pool sync and cause a deadlock.
+ */
+ dsl_pool_rele(dmu_objset_pool(os), FTAG);
s = zpl_sget(fs_type, zpl_test_super, set_anon_super, flags, os);
- dmu_objset_rele(os, FTAG);
+ dsl_dataset_rele(dmu_objset_ds(os), FTAG);
+
if (IS_ERR(s))
return (ERR_CAST(s));