diff options
author | Matthew Ahrens <[email protected]> | 2018-04-17 11:06:54 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-04-17 11:06:54 -0700 |
commit | 0c03d21ac99ebdbefe65c319fc3712928c40af78 (patch) | |
tree | 5ec1e603a374a089fcd5b1c5b673974a5e687c1b /module/zfs/dmu_objset.c | |
parent | b40d45bc6c0e908c4d1086ac8ac3dcd1f7178d2a (diff) |
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 <[email protected]>
Reviewed-by: Tom Caputi <[email protected]>
Signed-off-by: Matthew Ahrens <[email protected]>
Closes #7424
Closes #7429
Diffstat (limited to 'module/zfs/dmu_objset.c')
-rw-r--r-- | module/zfs/dmu_objset.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/module/zfs/dmu_objset.c b/module/zfs/dmu_objset.c index a44f485b7..f1813015a 100644 --- a/module/zfs/dmu_objset.c +++ b/module/zfs/dmu_objset.c @@ -1663,11 +1663,12 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx) dmu_write_policy(os, NULL, 0, 0, &zp); /* - * If we are either claiming the ZIL or doing a raw receive write out - * the os_phys_buf raw. Neither of these actions will effect the MAC - * at this point. + * If we are either claiming the ZIL or doing a raw receive, write + * out the os_phys_buf raw. Neither of these actions will effect the + * MAC at this point. */ - if (os->os_next_write_raw[tx->tx_txg & TXG_MASK]) { + if (os->os_raw_receive || + os->os_next_write_raw[tx->tx_txg & TXG_MASK]) { ASSERT(os->os_encrypted); os->os_next_write_raw[tx->tx_txg & TXG_MASK] = B_FALSE; arc_convert_to_raw(os->os_phys_buf, |