Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102947256
D41158.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D41158.diff
View Options
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -1443,6 +1443,7 @@
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,12 +1466,7 @@
}
foffset_lock_uio(fp, uio, flags);
- 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 (vp->v_type == VREG) {
if (uio->uio_rw == UIO_READ) {
rl_cookie = vn_rangelock_rlock(vp, uio->uio_offset,
uio->uio_offset + uio->uio_resid);
@@ -1482,11 +1478,22 @@
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);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 20, 2:17 AM (21 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14727854
Default Alt Text
D41158.diff (1 KB)
Attached To
Mode
D41158: vnode read(2)/write(2): acquire rangelock regardless of do_vn_io_fault()
Attached
Detach File
Event Timeline
Log In to Comment