diff options
author | jhb <jhb@FreeBSD.org> | 2010-07-16 19:20:20 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2010-07-16 19:20:20 +0000 |
commit | ea417bf09acdf5d9f44a16d4325b3b99dda501e3 (patch) | |
tree | 9b1c6ddf4f580be24a7413269d25ce4dbc614e35 /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c | |
parent | c23b0b441a985274551fcb108c06f12593545672 (diff) | |
download | FreeBSD-src-ea417bf09acdf5d9f44a16d4325b3b99dda501e3.zip FreeBSD-src-ea417bf09acdf5d9f44a16d4325b3b99dda501e3.tar.gz |
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
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c index 740302a..68ccd78 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c @@ -566,8 +566,11 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz) } break; } - if (vp->v_type != VFIFO) + if (vp->v_type != VFIFO) { + VI_LOCK(vp); VN_LOCK_ASHARE(vp); + VI_UNLOCK(vp); + } mutex_enter(&zfsvfs->z_znodes_lock); list_insert_tail(&zfsvfs->z_all_znodes, zp); |