OpenZFS 5380 - receive of a send -p stream doesn't need to try renaming snapshots

Authored by: Andriy Gapon <avg@FreeBSD.org>
Approved by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Ported-by: Giuseppe Di Natale <dinatale2@llnl.gov>

recv_incremental_replication() takes care of things like removing
datasets that have been removed on the sending side, detecting renamed
datasets, ensuring that all datasets in the affected hierarchy have the
same properties as their counterparts on the sending side.
All of the above are not necessary if we are receiving a stream for a
single dataset that has been generated with zfs send -p, that is, a
stream that includes properties.  zfs_receive_one() already takes care
of applying the properties to the received datasets.

OpenZFS-issue: https://www.illumos.org/issues/5380
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/b8ab927
Closes #5990
This commit is contained in:
Andriy Gapon 2017-04-07 13:54:29 -07:00 committed by Brian Behlendorf
parent f9ea47db3d
commit 4c3c6b6c73

View File

@ -2831,7 +2831,7 @@ zfs_receive_package(libzfs_handle_t *hdl, int fd, const char *destname,
goto out;
}
if (fromsnap != NULL) {
if (fromsnap != NULL && recursive) {
nvlist_t *renamed = NULL;
nvpair_t *pair = NULL;
@ -2858,7 +2858,7 @@ zfs_receive_package(libzfs_handle_t *hdl, int fd, const char *destname,
*strchr(tofs, '@') = '\0';
}
if (recursive && !flags->dryrun && !flags->nomount) {
if (!flags->dryrun && !flags->nomount) {
VERIFY(0 == nvlist_alloc(&renamed,
NV_UNIQUE_NAME, 0));
}
@ -2927,7 +2927,7 @@ zfs_receive_package(libzfs_handle_t *hdl, int fd, const char *destname,
anyerr |= error;
} while (error == 0);
if (drr->drr_payloadlen != 0 && fromsnap != NULL) {
if (drr->drr_payloadlen != 0 && recursive && fromsnap != NULL) {
/*
* Now that we have the fs's they sent us, try the
* renames again.