Skip to content

Commit

Permalink
Always wait for txg sync when umounting dataset
Browse files Browse the repository at this point in the history
Currently, when unmounting a filesystem, ZFS will only wait for
a txg sync if the dataset is dirty and not readonly. However, this
can be problematic in cases where a dataset is remounted readonly
immediately before being unmounted, which often happens when the
system is being shut down. Since encrypted datasets require that
all I/O is completed before the dataset is disowned, this issue
causes problems when write I/Os leak into the txgs after the
dataset is disowned, which can happen when sync=disabled. This
patch simply enforces that all dirty datasets should wait for a
txg sync before umount completes.

Fixes: openzfs#7753

Signed-off-by: Tom Caputi <[email protected]>
  • Loading branch information
Tom Caputi committed Aug 16, 2018
1 parent 4338c5c commit d26756d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions module/zfs/zfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1743,8 +1743,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting)
/*
* Evict cached data
*/
if (dsl_dataset_is_dirty(dmu_objset_ds(zfsvfs->z_os)) &&
!zfs_is_readonly(zfsvfs))
if (dsl_dataset_is_dirty(dmu_objset_ds(zfsvfs->z_os)))
txg_wait_synced(dmu_objset_pool(zfsvfs->z_os), 0);
dmu_objset_evict_dbufs(zfsvfs->z_os);

Expand Down

0 comments on commit d26756d

Please sign in to comment.