From f4512d2c471c181d6373c1338f6b6348515e433a Mon Sep 17 00:00:00 2001 From: George Amanakis Date: Tue, 15 Dec 2020 22:08:06 +0100 Subject: [PATCH] zero out dnodes Signed-off-by: George Amanakis --- module/zfs/dsl_crypt.c | 12 +++++++++++- .../userquota/userspace_send_encrypted.ksh | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/module/zfs/dsl_crypt.c b/module/zfs/dsl_crypt.c index e38ec0cae827..1f24c750c8e4 100644 --- a/module/zfs/dsl_crypt.c +++ b/module/zfs/dsl_crypt.c @@ -2097,12 +2097,22 @@ 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); + + /* + * Needed for triggering recalculation of metadata + */ os->os_phys->os_flags &= ~OBJSET_FLAG_USERACCOUNTING_COMPLETE; os->os_phys->os_flags &= ~OBJSET_FLAG_USEROBJACCOUNTING_COMPLETE; os->os_flags = os->os_phys->os_flags; - bzero(os->os_phys->os_local_mac, ZIO_OBJSET_MAC_LEN); os->os_next_write_raw[tx->tx_txg & TXG_MASK] = B_TRUE; + /* + * Needed for zeroing out the local_mac + */ + dmu_object_free(os, DMU_USERUSED_OBJECT, tx); + dmu_object_free(os, DMU_GROUPUSED_OBJECT, tx); + /* set metadnode compression and checksum */ mdn->dn_compress = compress; mdn->dn_checksum = checksum; diff --git a/tests/zfs-tests/tests/functional/userquota/userspace_send_encrypted.ksh b/tests/zfs-tests/tests/functional/userquota/userspace_send_encrypted.ksh index fbd2cc99b55b..ddee00eb82c8 100755 --- a/tests/zfs-tests/tests/functional/userquota/userspace_send_encrypted.ksh +++ b/tests/zfs-tests/tests/functional/userquota/userspace_send_encrypted.ksh @@ -92,6 +92,8 @@ log_must eval "echo password | zfs load-key $ENC_TARGET" log_must zfs mount $ENC_TARGET sync +sleep 5 + src_uspace=$(( $(zfs userspace -Hp $ENC_SOURCE | grep $QUSER1 | \ awk '{print $4}')/1024/1024)) tgt_uspace=$(( $(zfs userspace -Hp $ENC_TARGET | grep $QUSER1 | \