summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndriy Gapon <[email protected]>2015-07-02 16:03:31 +0300
committerBrian Behlendorf <[email protected]>2015-07-06 09:20:18 -0700
commitcf50a2b08ff66114a72f6d6d12f13439cd5c5b99 (patch)
tree132d369fde47b46927b4dd69ff51441b50cd0ce5
parenta7b10a931911d3a98a90965795daad031c6d33a2 (diff)
Illumos 5912 - full stream can not be force-received into a dataset if it has a snapshot
5912 full stream can not be force-received into a dataset if it has a snapshot Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Paul Dagnelie <[email protected]> Approved by: Dan McDonald <[email protected]> References: https://www.illumos.org/issues/5912 https://github.com/illumos/illumos-gate/commit/5bae108 Ported-by: Andriy Gapon <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3549
-rw-r--r--module/zfs/dmu_send.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/module/zfs/dmu_send.c b/module/zfs/dmu_send.c
index 8fa6797c4..d900d5cd0 100644
--- a/module/zfs/dmu_send.c
+++ b/module/zfs/dmu_send.c
@@ -1036,10 +1036,12 @@ recv_begin_check_existing_impl(dmu_recv_begin_arg_t *drba, dsl_dataset_t *ds,
dsl_dataset_rele(snap, FTAG);
} else {
- /* if full, most recent snapshot must be $ORIGIN */
- if (dsl_dataset_phys(ds)->ds_prev_snap_txg >= TXG_INITIAL)
- return (SET_ERROR(ENODEV));
- drba->drba_snapobj = dsl_dataset_phys(ds)->ds_prev_snap_obj;
+ /* if full, then must be forced */
+ if (!drba->drba_cookie->drc_force)
+ return (SET_ERROR(EEXIST));
+ /* start from $ORIGIN@$ORIGIN, if supported */
+ drba->drba_snapobj = dp->dp_origin_snap != NULL ?
+ dp->dp_origin_snap->ds_object : 0;
}
return (0);