diff options
author | truckman <truckman@FreeBSD.org> | 2003-06-19 04:10:56 +0000 |
---|---|---|
committer | truckman <truckman@FreeBSD.org> | 2003-06-19 04:10:56 +0000 |
commit | 84188f1f4fb2c8aadca4b5d65b5b74cd876b5f76 (patch) | |
tree | 1c31ed5dc4acec1005787bd89537d042f8322840 /sys/kern/vfs_extattr.c | |
parent | 82d03c66d5d36a6bc9db1738c71edd00b2d4e48c (diff) | |
download | FreeBSD-src-84188f1f4fb2c8aadca4b5d65b5b74cd876b5f76.zip FreeBSD-src-84188f1f4fb2c8aadca4b5d65b5b74cd876b5f76.tar.gz |
FILE_LOCK() uses a pool mutex, as does the vnode v_vnlock. Since pool
mutexes are supposed to only be used as leaf mutexes, and what appear
to be separate pool mutexes could be aliased together, it is bad idea
for a thread to attempt to hold two pool mutexes at the same time.
Slightly rearrange the code in kern_open() so that FILE_UNLOCK() is
called before calling VOP_GETVOBJECT(), which will grab the v_vnlock
mutex.
Diffstat (limited to 'sys/kern/vfs_extattr.c')
-rw-r--r-- | sys/kern/vfs_extattr.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index 6d42736..46ff3aa 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -745,17 +745,17 @@ kern_open(struct thread *td, char *path, enum uio_seg pathseg, int flags, td->td_retval[0] = indx; return 0; } - - /* assert that vn_open created a backing object if one is needed */ - KASSERT(!vn_canvmio(vp) || VOP_GETVOBJECT(vp, NULL) == 0, - ("open: vmio vnode has no backing object after vn_open")); - fp->f_data = vp; fp->f_flag = flags & FMASK; fp->f_ops = &vnops; fp->f_type = (vp->v_type == VFIFO ? DTYPE_FIFO : DTYPE_VNODE); FILEDESC_UNLOCK(fdp); FILE_UNLOCK(fp); + + /* assert that vn_open created a backing object if one is needed */ + KASSERT(!vn_canvmio(vp) || VOP_GETVOBJECT(vp, NULL) == 0, + ("open: vmio vnode has no backing object after vn_open")); + VOP_UNLOCK(vp, 0, td); if (flags & (O_EXLOCK | O_SHLOCK)) { lf.l_whence = SEEK_SET; |