Update the correct abd in l2arc_read_done()
This patch fixes an issue where l2arc_read_done() would always write data to b_pabd, even if raw encrypted data was requested. This only occured in cases where the L2ARC device had a different ashift than the main pool. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Signed-off-by: Tom Caputi <tcaputi@datto.com> Closes #7586 Closes #7593
This commit is contained in:
parent
e7504d7a18
commit
b405837a6c
|
@ -8248,17 +8248,18 @@ static void
|
||||||
l2arc_read_done(zio_t *zio)
|
l2arc_read_done(zio_t *zio)
|
||||||
{
|
{
|
||||||
int tfm_error = 0;
|
int tfm_error = 0;
|
||||||
l2arc_read_callback_t *cb;
|
l2arc_read_callback_t *cb = zio->io_private;
|
||||||
arc_buf_hdr_t *hdr;
|
arc_buf_hdr_t *hdr;
|
||||||
kmutex_t *hash_lock;
|
kmutex_t *hash_lock;
|
||||||
boolean_t valid_cksum, using_rdata;
|
boolean_t valid_cksum;
|
||||||
|
boolean_t using_rdata = (BP_IS_ENCRYPTED(&cb->l2rcb_bp) &&
|
||||||
|
(cb->l2rcb_flags & ZIO_FLAG_RAW_ENCRYPT));
|
||||||
|
|
||||||
ASSERT3P(zio->io_vd, !=, NULL);
|
ASSERT3P(zio->io_vd, !=, NULL);
|
||||||
ASSERT(zio->io_flags & ZIO_FLAG_DONT_PROPAGATE);
|
ASSERT(zio->io_flags & ZIO_FLAG_DONT_PROPAGATE);
|
||||||
|
|
||||||
spa_config_exit(zio->io_spa, SCL_L2ARC, zio->io_vd);
|
spa_config_exit(zio->io_spa, SCL_L2ARC, zio->io_vd);
|
||||||
|
|
||||||
cb = zio->io_private;
|
|
||||||
ASSERT3P(cb, !=, NULL);
|
ASSERT3P(cb, !=, NULL);
|
||||||
hdr = cb->l2rcb_hdr;
|
hdr = cb->l2rcb_hdr;
|
||||||
ASSERT3P(hdr, !=, NULL);
|
ASSERT3P(hdr, !=, NULL);
|
||||||
|
@ -8274,8 +8275,13 @@ l2arc_read_done(zio_t *zio)
|
||||||
if (cb->l2rcb_abd != NULL) {
|
if (cb->l2rcb_abd != NULL) {
|
||||||
ASSERT3U(arc_hdr_size(hdr), <, zio->io_size);
|
ASSERT3U(arc_hdr_size(hdr), <, zio->io_size);
|
||||||
if (zio->io_error == 0) {
|
if (zio->io_error == 0) {
|
||||||
abd_copy(hdr->b_l1hdr.b_pabd, cb->l2rcb_abd,
|
if (using_rdata) {
|
||||||
arc_hdr_size(hdr));
|
abd_copy(hdr->b_crypt_hdr.b_rabd,
|
||||||
|
cb->l2rcb_abd, arc_hdr_size(hdr));
|
||||||
|
} else {
|
||||||
|
abd_copy(hdr->b_l1hdr.b_pabd,
|
||||||
|
cb->l2rcb_abd, arc_hdr_size(hdr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -8292,8 +8298,7 @@ l2arc_read_done(zio_t *zio)
|
||||||
abd_free(cb->l2rcb_abd);
|
abd_free(cb->l2rcb_abd);
|
||||||
zio->io_size = zio->io_orig_size = arc_hdr_size(hdr);
|
zio->io_size = zio->io_orig_size = arc_hdr_size(hdr);
|
||||||
|
|
||||||
if (BP_IS_ENCRYPTED(&cb->l2rcb_bp) &&
|
if (using_rdata) {
|
||||||
(cb->l2rcb_flags & ZIO_FLAG_RAW_ENCRYPT)) {
|
|
||||||
ASSERT(HDR_HAS_RABD(hdr));
|
ASSERT(HDR_HAS_RABD(hdr));
|
||||||
zio->io_abd = zio->io_orig_abd =
|
zio->io_abd = zio->io_orig_abd =
|
||||||
hdr->b_crypt_hdr.b_rabd;
|
hdr->b_crypt_hdr.b_rabd;
|
||||||
|
@ -8314,8 +8319,6 @@ l2arc_read_done(zio_t *zio)
|
||||||
zio->io_bp = &zio->io_bp_copy; /* XXX fix in L2ARC 2.0 */
|
zio->io_bp = &zio->io_bp_copy; /* XXX fix in L2ARC 2.0 */
|
||||||
|
|
||||||
valid_cksum = arc_cksum_is_equal(hdr, zio);
|
valid_cksum = arc_cksum_is_equal(hdr, zio);
|
||||||
using_rdata = (HDR_HAS_RABD(hdr) &&
|
|
||||||
zio->io_abd == hdr->b_crypt_hdr.b_rabd);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* b_rabd will always match the data as it exists on disk if it is
|
* b_rabd will always match the data as it exists on disk if it is
|
||||||
|
|
Loading…
Reference in New Issue