mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Enable encrypted raw sending to pools with greater ashift
Raw sending from pool1/encrypted with ashift=9 to pool2/encrypted with ashift=12 results to failure when mounting pool2/encrypted (Input/Output error). Notably, the opposite, raw sending from a greater ashift to a lower one does not fail. This happens because zio_compress_write() falsely checks only ZIO_FLAG_RAW_COMPRESS and not ZIO_FLAG_RAW_ENCRYPT which is also set in encrypted raw send streams. In this case it rounds up the psize and if not equal to the zio->io_size it modifies the block by zeroing out the extra bytes. Because this happens in a SA attr. registration object (type=46), the decryption fails upon mounting the filesystem, and zpool status falsely reports an error. Fix this by checking both ZIO_FLAG_RAW_COMPRESS and ZIO_FLAG_RAW_ENCRYPT before deciding whether to zero-pad a block. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: George Amanakis <gamanakis@gmail.com> Closes #13067 Closes #13074
This commit is contained in:
committed by
Tony Hutter
parent
6c6153e5b8
commit
bcddb18bae
+7
-1
@@ -1773,7 +1773,13 @@ zio_write_compress(zio_t *zio)
|
||||
zio->io_abd, NULL, lsize, zp->zp_complevel);
|
||||
if (psize == 0 || psize >= lsize)
|
||||
compress = ZIO_COMPRESS_OFF;
|
||||
} else if (zio->io_flags & ZIO_FLAG_RAW_COMPRESS) {
|
||||
} else if (zio->io_flags & ZIO_FLAG_RAW_COMPRESS &&
|
||||
!(zio->io_flags & ZIO_FLAG_RAW_ENCRYPT)) {
|
||||
/*
|
||||
* If we are raw receiving an encrypted dataset we should not
|
||||
* take this codepath because it will change the on-disk block
|
||||
* and decryption will fail.
|
||||
*/
|
||||
size_t rounded = MIN((size_t)roundup(psize,
|
||||
spa->spa_min_alloc), lsize);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user