summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2015-09-11 12:41:59 +0000
committeravg <avg@FreeBSD.org>2015-09-11 12:41:59 +0000
commit423decf41a80e322c84f16ed8e771e031cfc2652 (patch)
treeb98c92039fe723432e48a353e8a2308bd035c469
parentc26752881eb1f52599525dab13d8562da2ef8e5d (diff)
downloadFreeBSD-src-423decf41a80e322c84f16ed8e771e031cfc2652.zip
FreeBSD-src-423decf41a80e322c84f16ed8e771e031cfc2652.tar.gz
MFC r285021: zfs_mount(MS_REMOUNT): protect zfs_(un)register_callbacks calls
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
index 4d310d7..b690b69 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
@@ -1706,9 +1706,19 @@ zfs_mount(vfs_t *vfsp)
* according to those options set in the current VFS options.
*/
if (vfsp->vfs_flag & MS_REMOUNT) {
- /* refresh mount options */
- zfs_unregister_callbacks(vfsp->vfs_data);
+ zfsvfs_t *zfsvfs = vfsp->vfs_data;
+
+ /*
+ * Refresh mount options with z_teardown_lock blocking I/O while
+ * the filesystem is in an inconsistent state.
+ * The lock also serializes this code with filesystem
+ * manipulations between entry to zfs_suspend_fs() and return
+ * from zfs_resume_fs().
+ */
+ rrm_enter(&zfsvfs->z_teardown_lock, RW_WRITER, FTAG);
+ zfs_unregister_callbacks(zfsvfs);
error = zfs_register_callbacks(vfsp);
+ rrm_exit(&zfsvfs->z_teardown_lock, FTAG);
goto out;
}
OpenPOWER on IntegriCloud