]> granicus.if.org Git - zfs/commit
Fix intra-pool resumable 'zfs send -t <token>'
authorLOLi <loli10K@users.noreply.github.com>
Tue, 10 Oct 2017 22:22:05 +0000 (00:22 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 10 Oct 2017 22:22:05 +0000 (15:22 -0700)
commitaee1dd4d983c64db3c3155290d48f05243e85709
treeee30dfe67c6bf3263517eaca69390365e50e24c3
parent70f02287f86db33950eba9ceeb4f4c07c23131e0
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
lib/libzfs/libzfs_iter.c
lib/libzfs/libzfs_sendrecv.c
tests/zfs-tests/tests/functional/rsend/rsend.kshlib
tests/zfs-tests/tests/functional/rsend/rsend_019_pos.ksh
tests/zfs-tests/tests/functional/rsend/rsend_020_pos.ksh
tests/zfs-tests/tests/functional/rsend/rsend_021_pos.ksh
tests/zfs-tests/tests/functional/rsend/rsend_022_pos.ksh
tests/zfs-tests/tests/functional/rsend/rsend_024_pos.ksh
tests/zfs-tests/tests/functional/rsend/send-c_resume.ksh