svn commit: r366341 - stable/12/cddl/contrib/opensolaris/lib/libzfs/common

Alan Somers asomers at FreeBSD.org
Thu Oct 1 19:55:53 UTC 2020


Author: asomers
Date: Thu Oct  1 19:55:52 2020
New Revision: 366341
URL: https://svnweb.freebsd.org/changeset/base/366341

Log:
  zfs: fix "zfs receive" of interrupted stream without "-F" after r366180
  
  The OpenZFS test suite revealed a regression with the changes made by
  r366180 and r364974: "zfs recv" resuming and interrupted stream without -F
  would refuse to run, complaining that "dataset exists".
  
  Direct commit to stable/12 because head has moved to the OpenZFS code base.
  
  Upstream issue: https://github.com/openzfs/zfs/issues/10995
  
  Reviewed by:	mmacy
  MFC after:	3 days
  MFC-with:	366180
  Sponsored by:	Axcient

Modified:
  stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c

Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==============================================================================
--- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c	Thu Oct  1 19:17:03 2020	(r366340)
+++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c	Thu Oct  1 19:55:52 2020	(r366341)
@@ -3138,7 +3138,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
 	char prop_errbuf[1024];
 	const char *chopprefix;
 	boolean_t newfs = B_FALSE;
-	boolean_t stream_wantsnewfs;
+	boolean_t stream_wantsnewfs, stream_resumingnewfs;
 	uint64_t parent_snapguid = 0;
 	prop_changelist_t *clp = NULL;
 	nvlist_t *snapprops_nvlist = NULL;
@@ -3301,7 +3301,9 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
 	boolean_t resuming = DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo) &
 	    DMU_BACKUP_FEATURE_RESUMING;
 	stream_wantsnewfs = (drrb->drr_fromguid == 0 ||
-	    (drrb->drr_flags & DRR_FLAG_CLONE) || originsnap);
+	    (drrb->drr_flags & DRR_FLAG_CLONE) || originsnap) && !resuming;
+	stream_resumingnewfs = (drrb->drr_fromguid == 0 ||
+	    (drrb->drr_flags & DRR_FLAG_CLONE) || originsnap) && resuming;
 
 	if (stream_wantsnewfs) {
 		/*
@@ -3433,7 +3435,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
 		}
 
 		if (!flags->dryrun && zhp->zfs_type == ZFS_TYPE_FILESYSTEM &&
-		    stream_wantsnewfs) {
+		    (stream_wantsnewfs || stream_resumingnewfs)) {
 			/* We can't do online recv in this case */
 			clp = changelist_gather(zhp, ZFS_PROP_NAME, 0, 0);
 			if (clp == NULL) {


More information about the svn-src-all mailing list