mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Fix raw sends on encrypted datasets when copying back snapshots
When sending raw encrypted datasets the user space accounting is present when it's not expected to be. This leads to the subsequent mount failure due a checksum error when verifying the local mac. Fix this by clearing the OBJSET_FLAG_USERACCOUNTING_COMPLETE and reset the local mac. This allows the user accounting to be correctly updated on first mount using the normal upgrade process. Reviewed-By: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-By: Tom Caputi <caputit1@tcnj.edu> Signed-off-by: George Amanakis <gamanakis@gmail.com> Closes #10523 Closes #11221
This commit is contained in:
@@ -1197,6 +1197,16 @@ zio_crypt_do_objset_hmacs(zio_crypt_key_t *key, void *data, uint_t datalen,
|
||||
|
||||
bcopy(raw_portable_mac, portable_mac, ZIO_OBJSET_MAC_LEN);
|
||||
|
||||
/*
|
||||
* This is necessary here as we check next whether
|
||||
* OBJSET_FLAG_USERACCOUNTING_COMPLETE or
|
||||
* OBJSET_FLAG_USEROBJACCOUNTING are set in order to
|
||||
* decide if the local_mac should be zeroed out.
|
||||
*/
|
||||
intval = osp->os_flags;
|
||||
if (should_bswap)
|
||||
intval = BSWAP_64(intval);
|
||||
|
||||
/*
|
||||
* The local MAC protects the user, group and project accounting.
|
||||
* If these objects are not present, the local MAC is zeroed out.
|
||||
@@ -1208,7 +1218,10 @@ zio_crypt_do_objset_hmacs(zio_crypt_key_t *key, void *data, uint_t datalen,
|
||||
(datalen >= OBJSET_PHYS_SIZE_V2 &&
|
||||
osp->os_userused_dnode.dn_type == DMU_OT_NONE &&
|
||||
osp->os_groupused_dnode.dn_type == DMU_OT_NONE) ||
|
||||
(datalen <= OBJSET_PHYS_SIZE_V1)) {
|
||||
(datalen <= OBJSET_PHYS_SIZE_V1) ||
|
||||
(((intval & OBJSET_FLAG_USERACCOUNTING_COMPLETE) == 0 ||
|
||||
(intval & OBJSET_FLAG_USEROBJACCOUNTING_COMPLETE) == 0) &&
|
||||
key->zk_version > 0)) {
|
||||
bzero(local_mac, ZIO_OBJSET_MAC_LEN);
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user