mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Receive checks should allow unencrypted child datasets
dmu_recv_begin_check() unconditionally sets the DS_HOLD_FLAG_DECRYPT flag before calling dsl_dataset_hold_flags(). If the key on the receiving side isn't loaded or the send stream contains embedded blocks, the receive check fails for a stream which is perfectly valid and could be received without any problem. This seems like a remnant of the initial design, where unencrypted datasets below encrypted ones weren't allowed. Add a condition to set `DS_HOLD_FLAG_DECRYPT` only for encrypted datasets, modify an existing test to detect this regression and add a test for raw replication streams. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: George Amanakis <gamanakis@gmail.com> Co-authored-by: George Amanakis <gamanakis@gmail.com> Signed-off-by: Attila Fülöp <attila@fueloep.org> Closes #13033 Closes #13076
This commit is contained in:
@@ -597,7 +597,15 @@ dmu_recv_begin_check(void *arg, dmu_tx_t *tx)
|
||||
if (!(flags & DRR_FLAG_SPILL_BLOCK))
|
||||
return (SET_ERROR(ZFS_ERR_SPILL_BLOCK_FLAG_MISSING));
|
||||
} else {
|
||||
dsflags |= DS_HOLD_FLAG_DECRYPT;
|
||||
/*
|
||||
* We support unencrypted datasets below encrypted ones now,
|
||||
* so add the DS_HOLD_FLAG_DECRYPT flag only if we are dealing
|
||||
* with a dataset we may encrypt.
|
||||
*/
|
||||
if (drba->drba_dcp != NULL &&
|
||||
drba->drba_dcp->cp_crypt != ZIO_CRYPT_OFF) {
|
||||
dsflags |= DS_HOLD_FLAG_DECRYPT;
|
||||
}
|
||||
}
|
||||
|
||||
error = dsl_dataset_hold_flags(dp, tofs, dsflags, FTAG, &ds);
|
||||
|
||||
Reference in New Issue
Block a user