diff options
author | Tom Caputi <[email protected]> | 2018-03-31 14:11:48 -0400 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-03-31 11:11:48 -0700 |
commit | 4515b1d01c936b8cf156e20ba42cdb8916bca80b (patch) | |
tree | 7a21c01a2306c93da79d5f261fd3a6a3af36026f /module/zfs/dbuf.c | |
parent | 77d8a0f1a4d0b2f59cee63088f7987cb38e66538 (diff) |
Encrypted dnode blocks should be prefetched raw
Encrypted dnode blocks are always initially read as raw data and
converted to decrypted data when an encrypted bonus buffer is
needed. This allows the DMU to be used for things like fetching
the DMU master node without requiring keys to be loaded. However,
dbuf_issue_final_prefetch() does not currently read the data as
raw. The end result of this is that prefetched dnode blocks are
read twice from disk: once decrypted and then again as raw data.
This patch corrects the issue by adding the flag when appropriate.
Reviewed by: Matt Ahrens <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tom Caputi <[email protected]>
Closes #7362
Diffstat (limited to 'module/zfs/dbuf.c')
-rw-r--r-- | module/zfs/dbuf.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index 7e3f0a713..0ecdbd583 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -2660,15 +2660,20 @@ dbuf_issue_final_prefetch(dbuf_prefetch_arg_t *dpa, blkptr_t *bp) if (BP_IS_HOLE(bp) || BP_IS_EMBEDDED(bp)) return; + int zio_flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE; arc_flags_t aflags = dpa->dpa_aflags | ARC_FLAG_NOWAIT | ARC_FLAG_PREFETCH; + /* dnodes are always read as raw and then converted later */ + if (BP_GET_TYPE(bp) == DMU_OT_DNODE && BP_IS_PROTECTED(bp) && + dpa->dpa_curlevel == 0) + zio_flags |= ZIO_FLAG_RAW; + ASSERT3U(dpa->dpa_curlevel, ==, BP_GET_LEVEL(bp)); ASSERT3U(dpa->dpa_curlevel, ==, dpa->dpa_zb.zb_level); ASSERT(dpa->dpa_zio != NULL); (void) arc_read(dpa->dpa_zio, dpa->dpa_spa, bp, NULL, NULL, - dpa->dpa_prio, ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE, - &aflags, &dpa->dpa_zb); + dpa->dpa_prio, zio_flags, &aflags, &dpa->dpa_zb); } /* |