OpenZFS 7340 - receive manual origin should override automatic origin

Authored by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Ported-by: George Melikov <mail@gmelikov.ru>

OpenZFS-issue: https://www.illumos.org/issues/7340
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/ed4e7a6
Closes #5681
This commit is contained in:
George Melikov 2017-01-27 22:47:54 +03:00 committed by Brian Behlendorf
parent a08abc1bb3
commit 160af77108

View File

@ -3225,7 +3225,12 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
/* /*
* Determine the name of the origin snapshot. * Determine the name of the origin snapshot.
*/ */
if (drrb->drr_flags & DRR_FLAG_CLONE) { if (originsnap) {
(void) strncpy(origin, originsnap, sizeof (origin));
if (flags->verbose)
(void) printf("using provided clone origin %s\n",
origin);
} else if (drrb->drr_flags & DRR_FLAG_CLONE) {
if (guid_to_name(hdl, destsnap, if (guid_to_name(hdl, destsnap,
drrb->drr_fromguid, B_FALSE, origin) != 0) { drrb->drr_fromguid, B_FALSE, origin) != 0) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
@ -3236,11 +3241,6 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
} }
if (flags->verbose) if (flags->verbose)
(void) printf("found clone origin %s\n", origin); (void) printf("found clone origin %s\n", origin);
} else if (originsnap) {
(void) strncpy(origin, originsnap, sizeof (origin));
if (flags->verbose)
(void) printf("using provided clone origin %s\n",
origin);
} }
boolean_t resuming = DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo) & boolean_t resuming = DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo) &