HomeFreeBSD

Fix intra-pool resumable 'zfs send -t <token>'

Description

Fix intra-pool resumable 'zfs send -t <token>'

Because resuming from a token requires "guid" -> "snapshot" mapping
we have to walk the whole dataset hierarchy to find the right snapshot
to send; when both source and destination exists, for an incremental
resumable stream, libzfs gets confused and picks up the wrong snapshot
to send from: this results in attempting to send

   "destination@snap1 -> source@snap2"

instead of

   "source@snap1 -> source@snap2"

which fails with a "Invalid cross-device link" error (EXDEV).

Fix this by adjusting the logic behind dataset traversal in
zfs_iter_children() to pick the right snapshot to send from.

Additionally update dry-run 'zfs send -t' to print its output to
stderr: this is consistent with other dry-run commands.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #6618
Closes #6619
Closes #6623

Details

Provenance
LOLi <loli10K@users.noreply.github.com>Authored on Oct 10 2017, 10:22 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Oct 10 2017, 10:22 PM
Parents
rG70f02287f86d: Fix ARC behavior on 32-bit systems
Branches
Unknown
Tags
Unknown