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:
Alexander Motin
2025-09-12 13:29:27 -04:00
committed by GitHub
parent 35f47cb4f4
commit cb5f9aa582
3 changed files with 10 additions and 2 deletions
+4
View File
@@ -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);
if (error)
return (error);
vn_seqc_write_begin(vp);
error = zfs_ioctl_setxattr(vp, fsx, cred);
vn_seqc_write_end(vp);
VOP_UNLOCK(vp);
return (error);
}
@@ -2206,6 +2208,7 @@ zfs_setattr_dir(znode_t *dzp)
if (err)
break;
vn_seqc_write_begin(ZTOV(zp));
mutex_enter(&dzp->z_lock);
if (zp->z_uid != dzp->z_uid) {
@@ -2255,6 +2258,7 @@ sa_add_projid_err:
dmu_tx_abort(tx);
}
tx = NULL;
vn_seqc_write_end(ZTOV(zp));
if (err != 0 && err != ENOENT)
break;