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
This commit is contained in:
Mark Johnston 2021-10-28 13:25:26 -04:00 committed by Brian Behlendorf
parent 68a7a9edc5
commit 4d1a3ba6ed

View File

@ -3431,7 +3431,6 @@ zfs_rename_(vnode_t *sdvp, vnode_t **svpp, struct componentname *scnp,
dmu_tx_commit(tx); dmu_tx_commit(tx);
unlockout: /* all 4 vnodes are locked, ZFS_ENTER called */ unlockout: /* all 4 vnodes are locked, ZFS_ENTER called */
ZFS_EXIT(zfsvfs);
if (want_seqc_end) { if (want_seqc_end) {
vn_seqc_write_end(*svpp); vn_seqc_write_end(*svpp);
vn_seqc_write_end(sdvp); vn_seqc_write_end(sdvp);
@ -3444,10 +3443,12 @@ unlockout: /* all 4 vnodes are locked, ZFS_ENTER called */
VOP_UNLOCK1(*svpp); VOP_UNLOCK1(*svpp);
VOP_UNLOCK1(sdvp); VOP_UNLOCK1(sdvp);
out: /* original two vnodes are locked */
MPASS(!want_seqc_end);
if (error == 0 && zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS) if (error == 0 && zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
zil_commit(zilog, 0); zil_commit(zilog, 0);
ZFS_EXIT(zfsvfs);
out: /* original two vnodes are locked */
MPASS(!want_seqc_end);
if (*tvpp != NULL) if (*tvpp != NULL)
VOP_UNLOCK1(*tvpp); VOP_UNLOCK1(*tvpp);