]> git.proxmox.com Git - mirror_zfs.git/commit
Fix encryption hierarchy issues with zfs recv -d
authorTom Caputi <tcaputi@datto.com>
Thu, 26 Sep 2019 00:02:33 +0000 (20:02 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 26 Sep 2019 00:02:32 +0000 (17:02 -0700)
commitbb61cc31851098ab41a7dcb56333a90b40d65129
treeec37bcf52d4e269d9ebd4a24696ee79215abf875
parent479d7d3ca6c61dce789e54eb02c04b90f9ce0c8f
Fix encryption hierarchy issues with zfs recv -d

Currently, the recv_fix_encryption_hierarchy() function accepts
'destsnap' as one of its parameters. Originally, this was intended
to be the top-level dataset of a receive (whether or not the
receive was recursive). Unfortunately, this parameter actually is
simply the input that is passed in from the command line. When
the user specifies 'zfs recv -d', this string is actually only the
name of the receiving pool since the rest of the name is derived
from the send stream. This causes the function to fail, leaving
some datasets with an invalid encryption hierarchy.

This patch resolves this problem by passing in the top_zfs variable
instead. In order to make this work, this patch also includes some
changes that ensure the value is always present when we need it.

Reviewed-by: loli10K <ezomori.nozomu@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tom Caputi <tcaputi@datto.com>
Closes #9273
Closes #9309
include/libzfs.h
lib/libzfs/libzfs_sendrecv.c
tests/runfiles/linux.run
tests/zfs-tests/tests/functional/cli_root/zfs_receive/Makefile.am
tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_raw_-d.ksh [new file with mode: 0755]