diff options
author | Chuck Silvers <chs@FreeBSD.org> | 2021-01-06 20:04:25 +0000 |
---|---|---|
committer | Chuck Silvers <chs@FreeBSD.org> | 2021-01-07 21:37:35 +0000 |
commit | 11403bdeb4158531af36bc7c51cbbba27deb69b1 (patch) | |
tree | 4a9898a1bd68a579829b111477a9cd81d41f2c06 | |
parent | 79eca6520e0a516a2c217d8c9faedb58ad5db204 (diff) | |
download | src-11403bdeb4158531af36bc7c51cbbba27deb69b1.tar.gz src-11403bdeb4158531af36bc7c51cbbba27deb69b1.zip |
vfs: fix rangelock range in vn_rdwr() for IO_APPEND
vn_rdwr() must lock the entire file range for IO_APPEND
just like vn_io_fault() does for O_APPEND.
Reviewed by: kib, imp, mckusick
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D28008
-rw-r--r-- | sys/kern/vfs_vnops.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index f69115047eba..2ca2cf124c23 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -584,6 +584,8 @@ vn_rdwr(enum uio_rw rw, struct vnode *vp, void *base, int len, off_t offset, if (rw == UIO_READ) { rl_cookie = vn_rangelock_rlock(vp, offset, offset + len); + } else if ((ioflg & IO_APPEND) != 0) { + rl_cookie = vn_rangelock_wlock(vp, 0, OFF_MAX); } else { rl_cookie = vn_rangelock_wlock(vp, offset, offset + len); |