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
This commit is contained in:
Andriy Gapon 2016-10-04 08:09:25 +00:00
parent 1ef15cafa0
commit 9ba3abc30e

View File

@ -1454,7 +1454,8 @@ zfs_lookup_lock(vnode_t *dvp, vnode_t *vp, const char *name, int lkflags)
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));
}