aboutsummaryrefslogtreecommitdiff
path: root/lib/libzfs/common/libzfs_sendrecv.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2018-02-22 04:01:05 +0000
committerAlexander Motin <mav@FreeBSD.org>2018-02-22 04:01:05 +0000
commit34ff7cee7a460f9a00f0b1bd170b791a4840d83d (patch)
treef1fa4805eabc717a59c8ca1ec201549e57c42359 /lib/libzfs/common/libzfs_sendrecv.c
parent4195015764f853a7cae9d55091ee8ea4f339353e (diff)
downloadsrc-34ff7cee7a460f9a00f0b1bd170b791a4840d83d.tar.gz
src-34ff7cee7a460f9a00f0b1bd170b791a4840d83d.zip
8940 Sending an intra-pool resumable send stream may result in EXDEV
illumos/illumos-gate@544132fce3fa6583f01318f9559adc46614343a7 "zfs send -t <token>" for an incremental send should be able to resume successfully when sending to the same pool: a subtle issue in zfs_iter_children() doesn't currently allow this. Because resuming from a token requires "guid" -> "dataset" mapping (guid_to_name()), we have to walk the whole hierarchy to find the right snapshots to send. When resuming an incremental send both source and destination live in the same pool and have the same guid: this is where zfs_iter_children() gets confused and picks up the wrong snapshot, so we end up trying to send an incremental "destination@snap1 -> source@snap2" stream instead of "source@snap1 -> source@snap2": this fails with an "Invalid cross-device link" (EXDEV) error. Reviewed by: Paul Dagnelie <pcd@delphix.com> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Approved by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org> Author: loli10K <ezomori.nozomu@gmail.com>
Notes
Notes: svn path=/vendor/illumos/dist/; revision=329807
Diffstat (limited to 'lib/libzfs/common/libzfs_sendrecv.c')
-rw-r--r--lib/libzfs/common/libzfs_sendrecv.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libzfs/common/libzfs_sendrecv.c b/lib/libzfs/common/libzfs_sendrecv.c
index 4e89dc053d1d..d3002aec290a 100644
--- a/lib/libzfs/common/libzfs_sendrecv.c
+++ b/lib/libzfs/common/libzfs_sendrecv.c
@@ -1577,6 +1577,7 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *flags, int outfd,
int error = 0;
char name[ZFS_MAX_DATASET_NAME_LEN];
enum lzc_send_flags lzc_flags = 0;
+ FILE *fout = (flags->verbose && flags->dryrun) ? stdout : stderr;
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
"cannot resume send"));
@@ -1591,9 +1592,9 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *flags, int outfd,
return (zfs_error(hdl, EZFS_FAULT, errbuf));
}
if (flags->verbose) {
- (void) fprintf(stderr, dgettext(TEXT_DOMAIN,
+ (void) fprintf(fout, dgettext(TEXT_DOMAIN,
"resume token contents:\n"));
- nvlist_print(stderr, resume_nvl);
+ nvlist_print(fout, resume_nvl);
}
if (nvlist_lookup_string(resume_nvl, "toname", &toname) != 0 ||
@@ -1650,7 +1651,7 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *flags, int outfd,
lzc_flags, &size);
if (error == 0)
size = MAX(0, (int64_t)(size - bytes));
- send_print_verbose(stderr, zhp->zfs_name, fromname,
+ send_print_verbose(fout, zhp->zfs_name, fromname,
size, flags->parsable);
}