Skip to content

Commit 12d3e1f

Browse files
amotintonyhutter
authored andcommitted
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 <[email protected]> Closes #17722
1 parent a68a9c7 commit 12d3e1f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

module/os/freebsd/zfs/zfs_acl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@ zfs_aclset_common(znode_t *zp, zfs_acl_t *aclp, cred_t *cr, dmu_tx_t *tx)
11751175
int count = 0;
11761176
zfs_acl_phys_t acl_phys;
11771177

1178-
if (zp->z_zfsvfs->z_replay == B_FALSE) {
1178+
if (ZTOV(zp) != NULL && zp->z_zfsvfs->z_replay == B_FALSE) {
11791179
ASSERT_VOP_IN_SEQC(ZTOV(zp));
11801180
}
11811181

module/os/freebsd/zfs/zfs_znode_os.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,10 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr,
794794
(*zpp)->z_mode = mode;
795795
(*zpp)->z_dnodesize = dnodesize;
796796

797+
vnode_t *vp = ZTOV(*zpp);
798+
if (!(flag & IS_ROOT_NODE))
799+
vn_seqc_write_begin(vp);
800+
797801
if (vap->va_mask & AT_XVATTR)
798802
zfs_xvattr_set(*zpp, (xvattr_t *)vap, tx);
799803

@@ -802,7 +806,7 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr,
802806
VERIFY0(zfs_aclset_common(*zpp, acl_ids->z_aclp, cr, tx));
803807
}
804808
if (!(flag & IS_ROOT_NODE)) {
805-
vnode_t *vp = ZTOV(*zpp);
809+
vn_seqc_write_end(vp);
806810
vp->v_vflag |= VV_FORCEINSMQ;
807811
int err = insmntque(vp, zfsvfs->z_vfs);
808812
vp->v_vflag &= ~VV_FORCEINSMQ;

0 commit comments

Comments
 (0)