aboutsummaryrefslogtreecommitdiff
path: root/sys/ufs/ffs
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2010-07-16 19:20:20 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2010-07-16 19:20:20 +0000
commitdbfcf8cfea089e7b1df1e49f71b9fa7fdb80c6df (patch)
tree9b1c6ddf4f580be24a7413269d25ce4dbc614e35 /sys/ufs/ffs
parent12c5cab23ea0cdb5924b9e7d566284ecb82eeb94 (diff)
downloadsrc-dbfcf8cfea089e7b1df1e49f71b9fa7fdb80c6df.tar.gz
src-dbfcf8cfea089e7b1df1e49f71b9fa7fdb80c6df.zip
When the MNTK_EXTENDED_SHARED mount option was added, some filesystems were
changed to defer the setting of VN_LOCK_ASHARE() (which clears LK_NOSHARE in the vnode lock's flags) until after they had determined if the vnode was a FIFO. This occurs after the vnode has been inserted a VFS hash or some similar table, so it is possible for another thread to find this vnode via vget() on an i-node number and block on the vnode lock. If the lockmgr interlock (vnode interlock for vnode locks) is not held when clearing the LK_NOSHARE flag, then the lk_flags field can be clobbered. As a result the thread blocked on the vnode lock may never get woken up. Fix this by holding the vnode interlock while modifying the lock flags in this case. MFC after: 3 days
Notes
Notes: svn path=/head/; revision=210171
Diffstat (limited to 'sys/ufs/ffs')
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index c099732398fd..aa9f19ac4be6 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1577,7 +1577,9 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags)
*/
if (vp->v_type != VFIFO) {
/* FFS supports shared locking for all files except fifos. */
+ VI_LOCK(vp);
VN_LOCK_ASHARE(vp);
+ VI_UNLOCK(vp);
}
/*