]> 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)
committerTony Hutter <hutter2@llnl.gov>
Mon, 16 Oct 2017 17:57:55 +0000 (10:57 -0700)
commit926c6ec4530ed57edada2a1e9528b367b0a58c07
tree05f2833b4f4485489df1ad6538a87a8714499457
parent91b2f6ab1cd6c105eae00d6e046d58eb7ab271db
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