aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2017-04-14 18:54:11 +0000
committerAndriy Gapon <avg@FreeBSD.org>2017-04-14 18:54:11 +0000
commit89a08ff6ba190602d9c71ae1d224f9374958547a (patch)
tree8761f0117088ddb5b83201dc3d87ba57b7b5843d /lib
parent5fab759ec69dd9094573232c8d4555f8ee95ff25 (diff)
downloadsrc-89a08ff6ba190602d9c71ae1d224f9374958547a.tar.gz
src-89a08ff6ba190602d9c71ae1d224f9374958547a.zip
7340 receive manual origin should override automatic origin
illumos/illumos-gate@ed4e7a6a5cbc5e8986dc649ad54435210487b102 https://github.com/illumos/illumos-gate/commit/ed4e7a6a5cbc5e8986dc649ad54435210487b102 https://www.illumos.org/issues/7340 When -o origin=<snapshot> is specified as part of a ZFS receive, that origin should override the automatic detection in libzfs. Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Approved by: Robert Mustacchi <rm@joyent.com> Author: Paul Dagnelie <pcd@delphix.com>
Notes
Notes: svn path=/vendor/illumos/dist/; revision=316934
Diffstat (limited to 'lib')
-rw-r--r--lib/libzfs/common/libzfs_sendrecv.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libzfs/common/libzfs_sendrecv.c b/lib/libzfs/common/libzfs_sendrecv.c
index d50b3e9b6773..2641d53e00d4 100644
--- a/lib/libzfs/common/libzfs_sendrecv.c
+++ b/lib/libzfs/common/libzfs_sendrecv.c
@@ -3173,7 +3173,12 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
/*
* Determine the name of the origin snapshot, store in zc_string.
*/
- if (drrb->drr_flags & DRR_FLAG_CLONE) {
+ if (originsnap) {
+ (void) strncpy(zc.zc_string, originsnap, sizeof (zc.zc_string));
+ if (flags->verbose)
+ (void) printf("using provided clone origin %s\n",
+ zc.zc_string);
+ } else if (drrb->drr_flags & DRR_FLAG_CLONE) {
if (guid_to_name(hdl, zc.zc_value,
drrb->drr_fromguid, B_FALSE, zc.zc_string) != 0) {
zcmd_free_nvlists(&zc);
@@ -3184,11 +3189,6 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
}
if (flags->verbose)
(void) printf("found clone origin %s\n", zc.zc_string);
- } else if (originsnap) {
- (void) strncpy(zc.zc_string, originsnap, sizeof (zc.zc_string));
- if (flags->verbose)
- (void) printf("using provided clone origin %s\n",
- zc.zc_string);
}
boolean_t resuming = DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo) &