Author: avg
Date: Tue Oct  4 08:09:25 2016
New Revision: 306665
URL: https://svnweb.freebsd.org/changeset/base/306665

Log:
  zfs: fix a wrong assertion for extended attributes
  
  For the extended attributes the order between z_teardown_lock and the
  vnode lock is different.
  The bug was triggered only with DIAGNOSTIC turned on.
  This fix is developed in cooperation with avos.
  
  PR:           213112
  Reported by:  avos
  Tested by:    avos
  MFC after:    1 week

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     Mon Oct 
 3 23:49:05 2016        (r306664)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c     Tue Oct 
 4 08:09:25 2016        (r306665)
@@ -1454,7 +1454,8 @@ zfs_lookup_lock(vnode_t *dvp, vnode_t *v
 
        ASSERT_VOP_LOCKED(dvp, __func__);
 #ifdef DIAGNOSTIC
-       ASSERT(!RRM_LOCK_HELD(&zfsvfs->z_teardown_lock));
+       if ((zdp->z_pflags & ZFS_XATTR) == 0)
+               VERIFY(!RRM_LOCK_HELD(&zfsvfs->z_teardown_lock));
 #endif
 
        if (name[0] == 0 || (name[0] == '.' && name[1] == 0)) {
@@ -5973,13 +5974,15 @@ zfs_lock(ap)
        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) {
+           (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) {
+           (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));
        }
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to