git: febdac6a879a - stable/13 - Revert "vnode read(2)/write(2): acquire rangelock regardless of do_vn_io_fault()"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 16 Aug 2023 09:17:31 UTC
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=febdac6a879ab5727d00086fc7c6f295b3036896 commit febdac6a879ab5727d00086fc7c6f295b3036896 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-08-06 01:23:42 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-08-16 09:16:09 +0000 Revert "vnode read(2)/write(2): acquire rangelock regardless of do_vn_io_fault()" (cherry picked from commit 651fdc3d198d066b18823db3b74cf38a0144dfac) --- sys/kern/vfs_vnops.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 42080181d094..8f618a9ad46d 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1442,7 +1442,6 @@ vn_io_fault(struct file *fp, struct uio *uio, struct ucred *active_cred, void *rl_cookie; struct vn_io_fault_args args; int error; - bool rl_locked; doio = uio->uio_rw == UIO_READ ? vn_read : vn_write; vp = fp->f_vnode; @@ -1465,7 +1464,12 @@ vn_io_fault(struct file *fp, struct uio *uio, struct ucred *active_cred, } foffset_lock_uio(fp, uio, flags); - if (vp->v_type == VREG) { + if (do_vn_io_fault(vp, uio)) { + args.kind = VN_IO_FAULT_FOP; + args.args.fop_args.fp = fp; + args.args.fop_args.doio = doio; + args.cred = active_cred; + args.flags = flags | FOF_OFFSET; if (uio->uio_rw == UIO_READ) { rl_cookie = vn_rangelock_rlock(vp, uio->uio_offset, uio->uio_offset + uio->uio_resid); @@ -1477,22 +1481,11 @@ vn_io_fault(struct file *fp, struct uio *uio, struct ucred *active_cred, rl_cookie = vn_rangelock_wlock(vp, uio->uio_offset, uio->uio_offset + uio->uio_resid); } - rl_locked = true; - } else { - rl_locked = false; - } - if (do_vn_io_fault(vp, uio)) { - args.kind = VN_IO_FAULT_FOP; - args.args.fop_args.fp = fp; - args.args.fop_args.doio = doio; - args.cred = active_cred; - args.flags = flags | FOF_OFFSET; error = vn_io_fault1(vp, uio, &args, td); + vn_rangelock_unlock(vp, rl_cookie); } else { error = doio(fp, uio, active_cred, flags | FOF_OFFSET, td); } - if (rl_locked) - vn_rangelock_unlock(vp, rl_cookie); foffset_unlock_uio(fp, uio, flags); return (error); }