diff options
-rw-r--r-- | module/zfs/dmu_send.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/module/zfs/dmu_send.c b/module/zfs/dmu_send.c index d900d5cd0..340926785 100644 --- a/module/zfs/dmu_send.c +++ b/module/zfs/dmu_send.c @@ -2042,7 +2042,7 @@ dmu_recv_end_check(void *arg, dmu_tx_t *tx) error = dsl_dataset_hold_obj(dp, obj, FTAG, &snap); if (error != 0) - return (error); + break; if (snap->ds_dir != origin_head->ds_dir) error = SET_ERROR(EINVAL); if (error == 0) { @@ -2052,7 +2052,11 @@ dmu_recv_end_check(void *arg, dmu_tx_t *tx) obj = dsl_dataset_phys(snap)->ds_prev_snap_obj; dsl_dataset_rele(snap, FTAG); if (error != 0) - return (error); + break; + } + if (error != 0) { + dsl_dataset_rele(origin_head, FTAG); + return (error); } } error = dsl_dataset_clone_swap_check_impl(drc->drc_ds, |