diff --git a/include/sys/zfs_vfsops.h b/include/sys/zfs_vfsops.h index febfdff97f25..31c9c6d7f74b 100644 --- a/include/sys/zfs_vfsops.h +++ b/include/sys/zfs_vfsops.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #ifdef __cplusplus diff --git a/module/zfs/zpl_super.c b/module/zfs/zpl_super.c index fc10271b787f..c71d08c169ca 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 zpl_sget(). + * Otherwise it is possible to block on the semaphore in grab_super(), + * which is held by deactivate_super() waiting on spa_sync(), and in + * turn the sync is blocked on zpl_mount_impl() holding the dsl pool + * lock. Only the dataset lock needs to held over the zpl_sget(). + */ + 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));