From 0c03d21ac99ebdbefe65c319fc3712928c40af78 Mon Sep 17 00:00:00 2001 From: Matthew Ahrens Date: Tue, 17 Apr 2018 11:06:54 -0700 Subject: assertion in arc_release() during encrypted receive In the existing code, when doing a raw (encrypted) zfs receive, we call arc_convert_to_raw() from open context. This creates a race condition between arc_release()/arc_change_state() and writing out the block from syncing context (arc_write_ready/done()). This change makes it so that when we are doing a raw (encrypted) zfs receive, we save the crypt parameters (salt, iv, mac) of dnode blocks in the dbuf_dirty_record_t, and call arc_convert_to_raw() from syncing context when writing out the block of dnodes. Additionally, we can eliminate dr_raw and associated setters, and instead know that dnode blocks are always raw when doing a zfs receive (see the new field os_raw_receive). Reviewed-by: Brian Behlendorf Reviewed-by: Tom Caputi Signed-off-by: Matthew Ahrens Closes #7424 Closes #7429 --- include/sys/dmu.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'include/sys/dmu.h') diff --git a/include/sys/dmu.h b/include/sys/dmu.h index ccc07006d..119584365 100644 --- a/include/sys/dmu.h +++ b/include/sys/dmu.h @@ -472,7 +472,6 @@ void dmu_object_set_checksum(objset_t *os, uint64_t object, uint8_t checksum, void dmu_object_set_compress(objset_t *os, uint64_t object, uint8_t compress, dmu_tx_t *tx); -int dmu_object_dirty_raw(objset_t *os, uint64_t object, dmu_tx_t *tx); int dmu_object_remap_indirects(objset_t *os, uint64_t object, uint64_t txg); @@ -715,7 +714,8 @@ struct blkptr *dmu_buf_get_blkptr(dmu_buf_t *db); * (ie. you've called dmu_tx_hold_object(tx, db->db_object)). */ void dmu_buf_will_dirty(dmu_buf_t *db, dmu_tx_t *tx); -void dmu_buf_will_change_crypt_params(dmu_buf_t *db, dmu_tx_t *tx); +void dmu_buf_set_crypt_params(dmu_buf_t *db_fake, boolean_t byteorder, + const uint8_t *salt, const uint8_t *iv, const uint8_t *mac, dmu_tx_t *tx); /* * You must create a transaction, then hold the objects which you will @@ -794,10 +794,7 @@ int dmu_free_range(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, dmu_tx_t *tx); int dmu_free_long_range(objset_t *os, uint64_t object, uint64_t offset, uint64_t size); -int dmu_free_long_range_raw(objset_t *os, uint64_t object, uint64_t offset, - uint64_t size); int dmu_free_long_object(objset_t *os, uint64_t object); -int dmu_free_long_object_raw(objset_t *os, uint64_t object); /* * Convenience functions. @@ -837,9 +834,6 @@ 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 -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