summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2021-10-28 13:25:26 -0400
committerTony Hutter <hutter2@llnl.gov>2021-12-13 10:43:22 -0800
commit47f098d2db99fc1765c7a168e3f145d29b714f17 (patch)
treeeafcf62e8a99b214876df0c9c6a1ebc1b878d5b5
parentd94d1a589c45b4f17d04924abe4977a8808c4123 (diff)
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
-rw-r--r--module/os/freebsd/zfs/zfs_vnops_os.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/module/os/freebsd/zfs/zfs_vnops_os.c b/module/os/freebsd/zfs/zfs_vnops_os.c
index 6d38c20b1..d71da4eb1 100644
--- a/module/os/freebsd/zfs/zfs_vnops_os.c
+++ b/module/os/freebsd/zfs/zfs_vnops_os.c
@@ -3443,7 +3443,6 @@ zfs_rename_(vnode_t *sdvp, vnode_t **svpp, struct componentname *scnp,
dmu_tx_commit(tx);
unlockout: /* all 4 vnodes are locked, ZFS_ENTER called */
- ZFS_EXIT(zfsvfs);
if (want_seqc_end) {
vn_seqc_write_end(*svpp);
vn_seqc_write_end(sdvp);
@@ -3456,10 +3455,12 @@ unlockout: /* all 4 vnodes are locked, ZFS_ENTER called */
VOP_UNLOCK1(*svpp);
VOP_UNLOCK1(sdvp);
-out: /* original two vnodes are locked */
- MPASS(!want_seqc_end);
if (error == 0 && zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
zil_commit(zilog, 0);
+ ZFS_EXIT(zfsvfs);
+
+out: /* original two vnodes are locked */
+ MPASS(!want_seqc_end);
if (*tvpp != NULL)
VOP_UNLOCK1(*tvpp);