mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Fix incremental recursive encrypted receive
Currently, incremental recursive encrypted receives fail to work for any snapshot after the first. The reason for this is because the check in zfs_setup_cmdline_props() did not properly realize that when the user attempts to use '-x encryption' in this situation, they are not really overriding the existing encryption property and instead are attempting to prevent it from changing. This resulted in an error message stating: "encryption property 'encryption' cannot be set or excluded for raw or incremental streams". This problem is fixed by updating the logic to expect this use case. Reviewed-by: loli10K <ezomori.nozomu@gmail.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Igor Kozhukhov <igor@dilos.org> Signed-off-by: Tom Caputi <tcaputi@datto.com> Closes #9494
This commit is contained in:
committed by
Brian Behlendorf
parent
28f7427ab1
commit
b4238327b4
@@ -4257,11 +4257,21 @@ zfs_setup_cmdline_props(libzfs_handle_t *hdl, zfs_type_t type,
|
||||
|
||||
/* raw streams can't override encryption properties */
|
||||
if ((zfs_prop_encryption_key_param(prop) ||
|
||||
prop == ZFS_PROP_ENCRYPTION) && (raw || !newfs)) {
|
||||
prop == ZFS_PROP_ENCRYPTION) && raw) {
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"encryption property '%s' cannot "
|
||||
"be set or excluded for raw or incremental "
|
||||
"streams."), name);
|
||||
"be set or excluded for raw streams."), name);
|
||||
ret = zfs_error(hdl, EZFS_BADPROP, errbuf);
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* incremental streams can only exclude encryption properties */
|
||||
if ((zfs_prop_encryption_key_param(prop) ||
|
||||
prop == ZFS_PROP_ENCRYPTION) && !newfs &&
|
||||
nvpair_type(nvp) != DATA_TYPE_BOOLEAN) {
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"encryption property '%s' cannot "
|
||||
"be set for incremental streams."), name);
|
||||
ret = zfs_error(hdl, EZFS_BADPROP, errbuf);
|
||||
goto error;
|
||||
}
|
||||
@@ -4279,10 +4289,12 @@ zfs_setup_cmdline_props(libzfs_handle_t *hdl, zfs_type_t type,
|
||||
*/
|
||||
if (nvlist_exists(origprops, name)) {
|
||||
nvlist_t *attrs;
|
||||
char *source = NULL;
|
||||
|
||||
attrs = fnvlist_lookup_nvlist(origprops, name);
|
||||
if (strcmp(fnvlist_lookup_string(attrs,
|
||||
ZPROP_SOURCE), ZPROP_SOURCE_VAL_RECVD) != 0)
|
||||
if (nvlist_lookup_string(attrs,
|
||||
ZPROP_SOURCE, &source) == 0 &&
|
||||
strcmp(source, ZPROP_SOURCE_VAL_RECVD) != 0)
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user