Date: Thu, 24 Nov 2016 09:00:51 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r309090 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <201611240900.uAO90pLL038715@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Thu Nov 24 09:00:51 2016 New Revision: 309090 URL: https://svnweb.freebsd.org/changeset/base/309090 Log: further fix zfs_lock() diagnostics It was very wrong to look at the vnode and znode internals without having locked the vnode first. Reported by: pho Tested by: pho MFC after: 1 week X-MFC with: r308887 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Nov 24 09:00:18 2016 (r309089) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Nov 24 09:00:51 2016 (r309090) @@ -5963,10 +5963,6 @@ zfs_vptocnp(struct vop_vptocnp_args *ap) } #ifdef DIAGNOSTIC -#define CHECK_LOR ((flags & LK_NOWAIT) == 0 && vp->v_mount != NULL && \ - (vp->v_iflag & VI_DOOMED) == 0 && vp->v_data != NULL && \ - (zp->z_pflags & ZFS_XATTR) == 0) - static int zfs_lock(ap) struct vop_lock1_args /* { @@ -5976,28 +5972,20 @@ 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; - zp = vp->v_data; - flags = ap->a_flags; - if ((flags & LK_INTERLOCK) == 0 && CHECK_LOR) { - zfsvfs = zp->z_zfsvfs; - VERIFY(!RRM_LOCK_HELD(&zfsvfs->z_teardown_lock)); - } err = vop_stdlock(ap); - if ((flags & LK_INTERLOCK) != 0 && CHECK_LOR) { - 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); } - -#undef CHECK_LOR #endif struct vop_vector zfs_vnodeops;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611240900.uAO90pLL038715>