summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_vnops.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2007-07-26 16:58:09 +0000
committerpjd <pjd@FreeBSD.org>2007-07-26 16:58:09 +0000
commitfe74e944d12452785490f4343dd388287bc64da4 (patch)
tree5a98f364f3abdf11cc44ba4d0cfc643ff591bd63 /sys/kern/vfs_vnops.c
parent8dc8d42bdcbcf383b19e382acdec9adc0bd70d90 (diff)
downloadFreeBSD-src-fe74e944d12452785490f4343dd388287bc64da4.zip
FreeBSD-src-fe74e944d12452785490f4343dd388287bc64da4.tar.gz
When we do open, we should lock the vnode exclusively. This fixes few races:
- fifo race, where two threads assign v_fifoinfo, - v_writecount modifications, - v_object modifications, - and probably more... Discussed with: kib, ups Approved by: re (rwatson)
Diffstat (limited to 'sys/kern/vfs_vnops.c')
-rw-r--r--sys/kern/vfs_vnops.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 019553d..4f5305e 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -184,7 +184,7 @@ restart:
ndp->ni_cnd.cn_nameiop = LOOKUP;
ndp->ni_cnd.cn_flags = ISOPEN |
((fmode & O_NOFOLLOW) ? NOFOLLOW : FOLLOW) |
- LOCKSHARED | LOCKLEAF | MPSAFE | AUDITVNODE1;
+ LOCKLEAF | MPSAFE | AUDITVNODE1;
if ((error = namei(ndp)) != 0)
return (error);
if (!mpsafe)
@@ -235,7 +235,7 @@ restart:
if (fmode & FWRITE)
vp->v_writecount++;
*flagp = fmode;
- ASSERT_VOP_LOCKED(vp, "vn_open_cred");
+ ASSERT_VOP_ELOCKED(vp, "vn_open_cred");
if (!mpsafe)
VFS_UNLOCK_GIANT(vfslocked);
return (0);
OpenPOWER on IntegriCloud