diff options
Diffstat (limited to 'module/zfs/zfs_vfsops.c')
-rw-r--r-- | module/zfs/zfs_vfsops.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/module/zfs/zfs_vfsops.c b/module/zfs/zfs_vfsops.c index 488eaa4f2..8ae2ef929 100644 --- a/module/zfs/zfs_vfsops.c +++ b/module/zfs/zfs_vfsops.c @@ -1745,10 +1745,10 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting) zfs_unregister_callbacks(zfsvfs); /* - * Evict cached data + * Evict cached data. We must write out any dirty data before + * disowning the dataset. */ - if (dsl_dataset_is_dirty(dmu_objset_ds(zfsvfs->z_os)) && - !zfs_is_readonly(zfsvfs)) + if (!zfs_is_readonly(zfsvfs)) txg_wait_synced(dmu_objset_pool(zfsvfs->z_os), 0); dmu_objset_evict_dbufs(zfsvfs->z_os); @@ -1970,6 +1970,9 @@ zfs_remount(struct super_block *sb, int *flags, zfs_mnt_t *zm) if (error) return (error); + if (!zfs_is_readonly(zfsvfs) && (*flags & MS_RDONLY)) + txg_wait_synced(dmu_objset_pool(zfsvfs->z_os), 0); + zfs_unregister_callbacks(zfsvfs); zfsvfs_vfs_free(zfsvfs->z_vfs); |