The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=920d813451e80c1566fe6bc76a9a9989914bb52a
commit 920d813451e80c1566fe6bc76a9a9989914bb52a Author: Rich Ercolani <[email protected]> AuthorDate: 2021-06-02 13:00:29 +0000 Commit: Mateusz Guzik <[email protected]> CommitDate: 2021-06-07 00:27:37 +0000 vfs: fix MNT_SYNCHRONOUS check in vn_write ca1ce50b2b5ef11d ("vfs: add more safety against concurrent forced unmount to vn_write") has a side effect of only checking MNT_SYNCHRONOUS if O_FSYNC is set. Reviewed By: mjg Differential Revision: https://reviews.freebsd.org/D30610 (cherry picked from commit a19ae1b099ad4d43588f15ef19b8506f606b27cb) --- sys/kern/vfs_vnops.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 6bf798cd73c5..4ce4678f292f 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1122,11 +1122,12 @@ vn_write(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, ioflag |= IO_NDELAY; if (fp->f_flag & O_DIRECT) ioflag |= IO_DIRECT; - if (fp->f_flag & O_FSYNC) { - mp = atomic_load_ptr(&vp->v_mount); - if (mp != NULL && mp->mnt_flag & MNT_SYNCHRONOUS) - ioflag |= IO_SYNC; - } + + mp = atomic_load_ptr(&vp->v_mount); + if ((fp->f_flag & O_FSYNC) || + (mp != NULL && (mp->mnt_flag & MNT_SYNCHRONOUS))) + ioflag |= IO_SYNC; + /* * For O_DSYNC we set both IO_SYNC and IO_DATASYNC, so that VOP_WRITE() * implementations that don't understand IO_DATASYNC fall back to full _______________________________________________ [email protected] mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "[email protected]"
