Skip to content

Commit 4d1a3ba

Browse files
markjdbbehlendorf
authored andcommitted
Exit the teardown section later in rename on FreeBSD
We have to hold the teardown lock while dereferencing zfsvfs->z_os and, I believe, when committing to the ZIL. Note that jumping to the "out" label, "error" is always non-zero. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Ryan Moeller <ryan@ixsystems.com> Signed-off-by: Mark Johnston <markj@FreeBSD.org> Closes #12704
1 parent 68a7a9e commit 4d1a3ba

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

module/os/freebsd/zfs/zfs_vnops_os.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3431,7 +3431,6 @@ zfs_rename_(vnode_t *sdvp, vnode_t **svpp, struct componentname *scnp,
34313431
dmu_tx_commit(tx);
34323432

34333433
unlockout: /* all 4 vnodes are locked, ZFS_ENTER called */
3434-
ZFS_EXIT(zfsvfs);
34353434
if (want_seqc_end) {
34363435
vn_seqc_write_end(*svpp);
34373436
vn_seqc_write_end(sdvp);
@@ -3444,10 +3443,12 @@ zfs_rename_(vnode_t *sdvp, vnode_t **svpp, struct componentname *scnp,
34443443
VOP_UNLOCK1(*svpp);
34453444
VOP_UNLOCK1(sdvp);
34463445

3447-
out: /* original two vnodes are locked */
3448-
MPASS(!want_seqc_end);
34493446
if (error == 0 && zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
34503447
zil_commit(zilog, 0);
3448+
ZFS_EXIT(zfsvfs);
3449+
3450+
out: /* original two vnodes are locked */
3451+
MPASS(!want_seqc_end);
34513452

34523453
if (*tvpp != NULL)
34533454
VOP_UNLOCK1(*tvpp);

0 commit comments

Comments
 (0)