diff options
author | Andriy Gapon <[email protected]> | 2015-07-02 16:03:58 +0300 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-07-06 09:22:18 -0700 |
commit | b6640117f07c50f5fc3093c6b50de988cf332e72 (patch) | |
tree | 4b61022f989a4cfb21d3b729562d3bb6ff7c8e83 | |
parent | fec417097b0289fb7c1c34cc919fefa48786d20c (diff) |
Illumos 5870 - dmu_recv_end_check() leaks origin_head hold if error happens in drc_force branch
5870 dmu_recv_end_check() leaks origin_head hold if error happens in drc_force branch
Reviewed by: Matthew Ahrens <[email protected]>
Reviewed by: Andrew Stormont <[email protected]>
Approved by: Dan McDonald <[email protected]>
References:
https://www.illumos.org/issues/5870
https://github.com/illumos/illumos-gate/commit/beddaa9
Ported-by: Andriy Gapon <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #3551
-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, |