mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
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 <behlendorf1@llnl.gov> Reviewed-by: Tom Caputi <tcaputi@datto.com> Signed-off-by: Matthew Ahrens <mahrens@delphix.com> Closes #7424 Closes #7429
This commit is contained in:
committed by
Brian Behlendorf
parent
b40d45bc6c
commit
0c03d21ac9
+10
-1
@@ -147,7 +147,16 @@ typedef struct dbuf_dirty_record {
|
||||
override_states_t dr_override_state;
|
||||
uint8_t dr_copies;
|
||||
boolean_t dr_nopwrite;
|
||||
boolean_t dr_raw;
|
||||
boolean_t dr_has_raw_params;
|
||||
|
||||
/*
|
||||
* If dr_has_raw_params is set, the following crypt
|
||||
* params will be set on the BP that's written.
|
||||
*/
|
||||
boolean_t dr_byteorder;
|
||||
uint8_t dr_salt[ZIO_DATA_SALT_LEN];
|
||||
uint8_t dr_iv[ZIO_DATA_IV_LEN];
|
||||
uint8_t dr_mac[ZIO_DATA_MAC_LEN];
|
||||
} dl;
|
||||
} dt;
|
||||
} dbuf_dirty_record_t;
|
||||
|
||||
+2
-8
@@ -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
|
||||
|
||||
@@ -139,6 +139,7 @@ struct objset {
|
||||
uint64_t os_flags;
|
||||
uint64_t os_freed_dnodes;
|
||||
boolean_t os_rescan_dnodes;
|
||||
boolean_t os_raw_receive;
|
||||
|
||||
/* os_phys_buf should be written raw next txg */
|
||||
boolean_t os_next_write_raw[TXG_SIZE];
|
||||
|
||||
Reference in New Issue
Block a user