summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authortegge <tegge@FreeBSD.org>2003-03-26 19:21:12 +0000
committertegge <tegge@FreeBSD.org>2003-03-26 19:21:12 +0000
commitd9da9de2571cfcb93b9f34cc09106cc13e31d72d (patch)
tree24f851a873c8d6b97430009c2e11701df671fe57 /sys/kern
parent5a1c87126631f2f5e816ea796b31f8b9870e915c (diff)
downloadFreeBSD-src-d9da9de2571cfcb93b9f34cc09106cc13e31d72d.zip
FreeBSD-src-d9da9de2571cfcb93b9f34cc09106cc13e31d72d.tar.gz
fp->f_offset doesn't need any protection when it isn't accessed.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_vnops.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index eba9f5d..a01733f 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -513,9 +513,11 @@ vn_read(fp, uio, active_cred, flags, td)
* According to McKusick the vn lock is protecting f_offset here.
* Once this field has it's own lock we can acquire this shared.
*/
- vn_lock(vp, LK_EXCLUSIVE | LK_NOPAUSE | LK_RETRY, td);
- if ((flags & FOF_OFFSET) == 0)
+ if ((flags & FOF_OFFSET) == 0) {
+ vn_lock(vp, LK_EXCLUSIVE | LK_NOPAUSE | LK_RETRY, td);
uio->uio_offset = fp->f_offset;
+ } else
+ vn_lock(vp, LK_SHARED | LK_NOPAUSE | LK_RETRY, td);
ioflag |= sequential_heuristic(uio, fp);
OpenPOWER on IntegriCloud