From b6d7370b9de5ebc7aae8ada702c3d05b81d28d77 Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Wed, 3 May 2023 00:24:47 -0700 Subject: [PATCH] Don't call zfs_exit_two() before zfs_enter_two(). Reviewed-by: Brian Behlendorf Signed-off-by: Pawel Jakub Dawidek Closes #14825 --- module/zfs/zfs_vnops.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index dca76227a4ac..86706469acee 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -1072,6 +1072,15 @@ zfs_clone_range(znode_t *inzp, uint64_t *inoffp, znode_t *outzp, inzfsvfs = ZTOZSB(inzp); outzfsvfs = ZTOZSB(outzp); + + /* + * We need to call zfs_enter() potentially on two different datasets, + * so we need a dedicated function for that. + */ + error = zfs_enter_two(inzfsvfs, outzfsvfs, FTAG); + if (error != 0) + return (error); + inos = inzfsvfs->z_os; outos = outzfsvfs->z_os; @@ -1083,14 +1092,6 @@ zfs_clone_range(znode_t *inzp, uint64_t *inoffp, znode_t *outzp, return (SET_ERROR(EXDEV)); } - /* - * We need to call zfs_enter() potentially on two different datasets, - * so we need a dedicated function for that. - */ - error = zfs_enter_two(inzfsvfs, outzfsvfs, FTAG); - if (error != 0) - return (error); - ASSERT(!outzfsvfs->z_replay); error = zfs_verify_zp(inzp);