dmu_recv_end_check: don't leak hold if dsl_destroy_snapshot_check_impl fails

The leak may happen if !drc_newfs && drc_force and there is an error
iterating through snapshots or any of snapshot checks fails.

See https://www.illumos.org/issues/5870
See https://reviews.csiden.org/r/206/

Reviewed by:	mahrens (as mahrens@delphix.com)
MFC after:	15 days
Sponsored by:	ClusterHQ
This commit is contained in:
Andriy Gapon 2015-05-05 10:56:16 +00:00
parent 3ef1b3b535
commit ce0023d851

View File

@ -2010,7 +2010,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) {
@ -2020,7 +2020,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,