mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Introduce a flag to skip comparing the local mac when raw sending
Raw receiving a snapshot back to the originating dataset is currently impossible because of user accounting being present in the originating dataset. One solution would be resetting user accounting when raw receiving on the receiving dataset. However, to recalculate it we would have to dirty all dnodes, which may not be preferable on big datasets. Instead, we rely on the os_phys flag OBJSET_FLAG_USERACCOUNTING_COMPLETE to indicate that user accounting is incomplete when raw receiving. Thus, on the next mount of the receiving dataset the local mac protecting user accounting is zeroed out. The flag is then cleared when user accounting of the raw received snapshot is calculated. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: George Amanakis <gamanakis@gmail.com> Closes #12981 Closes #10523 Closes #11221 Closes #11294 Closes #12594 Issue #11300
This commit is contained in:
committed by
Tony Hutter
parent
1009e60992
commit
e257bd481b
@@ -655,8 +655,13 @@ dnode_sync(dnode_t *dn, dmu_tx_t *tx)
|
||||
DNODE_FLAG_USEROBJUSED_ACCOUNTED;
|
||||
mutex_exit(&dn->dn_mtx);
|
||||
dmu_objset_userquota_get_ids(dn, B_FALSE, tx);
|
||||
} else {
|
||||
/* Once we account for it, we should always account for it */
|
||||
} else if (!(os->os_encrypted && dmu_objset_is_receiving(os))) {
|
||||
/*
|
||||
* Once we account for it, we should always account for it,
|
||||
* except for the case of a raw receive. We will not be able
|
||||
* to account for it until the receiving dataset has been
|
||||
* mounted.
|
||||
*/
|
||||
ASSERT(!(dn->dn_phys->dn_flags &
|
||||
DNODE_FLAG_USERUSED_ACCOUNTED));
|
||||
ASSERT(!(dn->dn_phys->dn_flags &
|
||||
|
||||
@@ -2007,14 +2007,6 @@ dsl_crypto_recv_raw_objset_check(dsl_dataset_t *ds, dsl_dataset_t *fromds,
|
||||
if (ret != 0)
|
||||
return (ret);
|
||||
|
||||
/*
|
||||
* Useraccounting is not portable and must be done with the keys loaded.
|
||||
* Therefore, whenever we do any kind of receive the useraccounting
|
||||
* must not be present.
|
||||
*/
|
||||
ASSERT0(os->os_flags & OBJSET_FLAG_USERACCOUNTING_COMPLETE);
|
||||
ASSERT0(os->os_flags & OBJSET_FLAG_USEROBJACCOUNTING_COMPLETE);
|
||||
|
||||
mdn = DMU_META_DNODE(os);
|
||||
|
||||
/*
|
||||
@@ -2106,6 +2098,7 @@ dsl_crypto_recv_raw_objset_sync(dsl_dataset_t *ds, dmu_objset_type_t ostype,
|
||||
arc_release(os->os_phys_buf, &os->os_phys_buf);
|
||||
bcopy(portable_mac, os->os_phys->os_portable_mac, ZIO_OBJSET_MAC_LEN);
|
||||
bzero(os->os_phys->os_local_mac, ZIO_OBJSET_MAC_LEN);
|
||||
os->os_flags &= ~OBJSET_FLAG_USERACCOUNTING_COMPLETE;
|
||||
os->os_next_write_raw[tx->tx_txg & TXG_MASK] = B_TRUE;
|
||||
|
||||
/* set metadnode compression and checksum */
|
||||
|
||||
Reference in New Issue
Block a user