mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-01-25 10:12:13 +03:00
FreeBSD: Satisfy ASSERT_VOP_IN_SEQC()
zfs_aclset_common() might be called for newly created or not even created vnodes, that triggers assertions on newer FreeBSD versions with DEBUG_VFS_LOCKS included into INVARIANTS. In the first case make sure to call vn_seqc_write_begin()/_end(), in the second just skip the assertion. The similar has to be done for project management IOCTL and file- bases extended attributes, since those are not going through VFS. Signed-off-by: Alexander Motin <alexander.motin@TrueNAS.com> Closes #17722
This commit is contained in:
parent
2f41193a26
commit
b5d41deca9
@ -1175,7 +1175,7 @@ zfs_aclset_common(znode_t *zp, zfs_acl_t *aclp, cred_t *cr, dmu_tx_t *tx)
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
zfs_acl_phys_t acl_phys;
|
zfs_acl_phys_t acl_phys;
|
||||||
|
|
||||||
if (zp->z_zfsvfs->z_replay == B_FALSE) {
|
if (ZTOV(zp) != NULL && zp->z_zfsvfs->z_replay == B_FALSE) {
|
||||||
ASSERT_VOP_IN_SEQC(ZTOV(zp));
|
ASSERT_VOP_IN_SEQC(ZTOV(zp));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -389,7 +389,9 @@ zfs_ioctl(vnode_t *vp, ulong_t com, intptr_t data, int flag, cred_t *cred,
|
|||||||
error = vn_lock(vp, LK_EXCLUSIVE);
|
error = vn_lock(vp, LK_EXCLUSIVE);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
|
vn_seqc_write_begin(vp);
|
||||||
error = zfs_ioctl_setxattr(vp, fsx, cred);
|
error = zfs_ioctl_setxattr(vp, fsx, cred);
|
||||||
|
vn_seqc_write_end(vp);
|
||||||
VOP_UNLOCK(vp);
|
VOP_UNLOCK(vp);
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
@ -2206,6 +2208,7 @@ zfs_setattr_dir(znode_t *dzp)
|
|||||||
if (err)
|
if (err)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
vn_seqc_write_begin(ZTOV(zp));
|
||||||
mutex_enter(&dzp->z_lock);
|
mutex_enter(&dzp->z_lock);
|
||||||
|
|
||||||
if (zp->z_uid != dzp->z_uid) {
|
if (zp->z_uid != dzp->z_uid) {
|
||||||
@ -2255,6 +2258,7 @@ sa_add_projid_err:
|
|||||||
dmu_tx_abort(tx);
|
dmu_tx_abort(tx);
|
||||||
}
|
}
|
||||||
tx = NULL;
|
tx = NULL;
|
||||||
|
vn_seqc_write_end(ZTOV(zp));
|
||||||
if (err != 0 && err != ENOENT)
|
if (err != 0 && err != ENOENT)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@ -817,6 +817,10 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr,
|
|||||||
(*zpp)->z_dnodesize = dnodesize;
|
(*zpp)->z_dnodesize = dnodesize;
|
||||||
(*zpp)->z_projid = projid;
|
(*zpp)->z_projid = projid;
|
||||||
|
|
||||||
|
vnode_t *vp = ZTOV(*zpp);
|
||||||
|
if (!(flag & IS_ROOT_NODE))
|
||||||
|
vn_seqc_write_begin(vp);
|
||||||
|
|
||||||
if (vap->va_mask & AT_XVATTR)
|
if (vap->va_mask & AT_XVATTR)
|
||||||
zfs_xvattr_set(*zpp, (xvattr_t *)vap, tx);
|
zfs_xvattr_set(*zpp, (xvattr_t *)vap, tx);
|
||||||
|
|
||||||
@ -825,7 +829,7 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr,
|
|||||||
VERIFY0(zfs_aclset_common(*zpp, acl_ids->z_aclp, cr, tx));
|
VERIFY0(zfs_aclset_common(*zpp, acl_ids->z_aclp, cr, tx));
|
||||||
}
|
}
|
||||||
if (!(flag & IS_ROOT_NODE)) {
|
if (!(flag & IS_ROOT_NODE)) {
|
||||||
vnode_t *vp = ZTOV(*zpp);
|
vn_seqc_write_end(vp);
|
||||||
vp->v_vflag |= VV_FORCEINSMQ;
|
vp->v_vflag |= VV_FORCEINSMQ;
|
||||||
int err = insmntque(vp, zfsvfs->z_vfs);
|
int err = insmntque(vp, zfsvfs->z_vfs);
|
||||||
vp->v_vflag &= ~VV_FORCEINSMQ;
|
vp->v_vflag &= ~VV_FORCEINSMQ;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user