From 095495e0081c16a18641fc60e7c9872123a4f83e Mon Sep 17 00:00:00 2001 From: Tom Caputi Date: Tue, 27 Feb 2018 12:04:05 -0500 Subject: Raw DRR_OBJECT records must write raw data b1d21733 made it possible for empty metadnode blocks to be compressed to a hole, fixing a bug that would cause invalid metadnode MACs when a send stream attempted to free objects and allowing the blocks to be reclaimed when they were no longer needed. However, this patch also introduced a race condition; if a txg sync occurred after a DRR_OBJECT_RANGE record was received but before any objects were added, the metadnode block would be compressed to a hole and lose all of its encryption parameters. This would cause subsequent DRR_OBJECT records to fail when they attempted to write their data into an unencrypted block. This patch defers the DRR_OBJECT_RANGE handling to receive_object() so that the encryption parameters are set with each object that is written into that block. Reviewed-by: Kash Pande Reviewed-by: Brian Behlendorf Signed-off-by: Tom Caputi Closes #7215 Closes #7236 --- include/sys/dmu.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/sys/dmu.h b/include/sys/dmu.h index 472a4f2b6..4d805b6d7 100644 --- a/include/sys/dmu.h +++ b/include/sys/dmu.h @@ -821,8 +821,9 @@ void dmu_assign_arcbuf_by_dnode(dnode_t *dn, uint64_t offset, void dmu_assign_arcbuf_by_dbuf(dmu_buf_t *handle, uint64_t offset, struct arc_buf *buf, dmu_tx_t *tx); #define dmu_assign_arcbuf dmu_assign_arcbuf_by_dbuf -void dmu_convert_to_raw(dmu_buf_t *handle, boolean_t byteorder, - const uint8_t *salt, const uint8_t *iv, const uint8_t *mac, dmu_tx_t *tx); +int dmu_convert_mdn_block_to_raw(objset_t *os, uint64_t firstobj, + boolean_t byteorder, const uint8_t *salt, const uint8_t *iv, + const uint8_t *mac, dmu_tx_t *tx); void dmu_copy_from_buf(objset_t *os, uint64_t object, uint64_t offset, dmu_buf_t *handle, dmu_tx_t *tx); #ifdef HAVE_UIO_ZEROCOPY -- cgit v1.2.3