Author: avg
Date: Fri Oct  6 08:17:12 2017
New Revision: 324348
URL: https://svnweb.freebsd.org/changeset/base/324348

Log:
  MFV r316934: 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.wil...@delphix.com>
  Reviewed by: Matthew Ahrens <mahr...@delphix.com>
  Approved by: Robert Mustacchi <r...@joyent.com>
  Author: Paul Dagnelie <p...@delphix.com>
  
  MFC after:    3 weeks

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/lib/libzfs/   (props changed)

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c   Fri Oct 
 6 08:15:37 2017        (r324347)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c   Fri Oct 
 6 08:17:12 2017        (r324348)
@@ -3212,7 +3212,12 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
        /*
         * 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);
@@ -3223,11 +3228,6 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
                }
                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) &
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to