diff options
author | avg <avg@FreeBSD.org> | 2016-12-14 16:08:35 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2016-12-14 16:08:35 +0000 |
commit | 6872d82f708dc9afa568571cbc2ac7ba0b4564c2 (patch) | |
tree | e966a1601564f27fab95801e7ada0e543028f480 /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | |
parent | c4ce610aeaa6d50d093ec18897c3ab63b5f9e536 (diff) | |
download | FreeBSD-src-6872d82f708dc9afa568571cbc2ac7ba0b4564c2.zip FreeBSD-src-6872d82f708dc9afa568571cbc2ac7ba0b4564c2.tar.gz |
MFC r308887,309090: fix unsafe modification of zfs_vnodeops when
DIAGNOSTIC is enabled
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index dcfa70f..fa22523 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -6020,26 +6020,17 @@ zfs_lock(ap) int line; } */ *ap; { - zfsvfs_t *zfsvfs; - znode_t *zp; vnode_t *vp; - int flags; + znode_t *zp; int err; - vp = ap->a_vp; - flags = ap->a_flags; - if ((flags & LK_INTERLOCK) == 0 && (flags & LK_NOWAIT) == 0 && - (vp->v_iflag & VI_DOOMED) == 0 && (zp = vp->v_data) != NULL && - (zp->z_pflags & ZFS_XATTR) == 0) { - zfsvfs = zp->z_zfsvfs; - VERIFY(!RRM_LOCK_HELD(&zfsvfs->z_teardown_lock)); - } err = vop_stdlock(ap); - if ((flags & LK_INTERLOCK) != 0 && (flags & LK_NOWAIT) == 0 && - (vp->v_iflag & VI_DOOMED) == 0 && (zp = vp->v_data) != NULL && - (zp->z_pflags & ZFS_XATTR) == 0) { - zfsvfs = zp->z_zfsvfs; - VERIFY(!RRM_LOCK_HELD(&zfsvfs->z_teardown_lock)); + if (err == 0 && (ap->a_flags & LK_NOWAIT) == 0) { + vp = ap->a_vp; + zp = vp->v_data; + if (vp->v_mount != NULL && (vp->v_iflag & VI_DOOMED) == 0 && + zp != NULL && (zp->z_pflags & ZFS_XATTR) == 0) + VERIFY(!RRM_LOCK_HELD(&zp->z_zfsvfs->z_teardown_lock)); } return (err); } |