Date: Mon, 7 Jun 2021 00:27:58 GMT From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 920d813451e8 - stable/13 - vfs: fix MNT_SYNCHRONOUS check in vn_write Message-ID: <202106070027.1570RwYK045621@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=920d813451e80c1566fe6bc76a9a9989914bb52a commit 920d813451e80c1566fe6bc76a9a9989914bb52a Author: Rich Ercolani <rincebrain@gmail.com> AuthorDate: 2021-06-02 13:00:29 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106070027.1570RwYK045621>