diff options
author | Tom Caputi <[email protected]> | 2018-05-01 14:24:20 -0400 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-05-01 11:24:20 -0700 |
commit | 2c24b5b1487646f68960f25e13a1b0df645d4f49 (patch) | |
tree | 3f4ad2ba92d441d6a8b132daaa93f69024b6a71e /module/zfs/arc.c | |
parent | d6133fc500ea8b4fdc1a51944cb17ea5e70f3137 (diff) |
Fix issues found with zfs diff
Two deadlocks / ASSERT failures were introduced in a2c2ed1b which
would occur whenever arc_buf_fill() failed to decrypt a block of
data. This occurred because the call to arc_buf_destroy() which
was responsible for cleaning up the newly created buffer would
attempt to take out the hdr lock that it was already holding. This
was resolved by calling the underlying functions directly without
retaking the lock.
In addition, the dmu_diff() code did not properly ensure that keys
were loaded and mapped before begining dataset traversal. It turns
out that this code does not need to look at any encrypted values,
so the code was altered to perform raw IO only.
Reviewed by: Matthew Ahrens <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tom Caputi <[email protected]>
Closes #7354
Closes #7456
Diffstat (limited to 'module/zfs/arc.c')
-rw-r--r-- | module/zfs/arc.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 040e94365..fa7f62d99 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -2132,8 +2132,10 @@ arc_buf_fill(arc_buf_t *buf, spa_t *spa, uint64_t dsobj, arc_fill_flags_t flags) if (HDR_PROTECTED(hdr)) { error = arc_fill_hdr_crypt(hdr, hash_lock, spa, dsobj, !!(flags & ARC_FILL_NOAUTH)); - if (error != 0) + if (error != 0) { + arc_hdr_set_flags(hdr, ARC_FLAG_IO_ERROR); return (error); + } } /* @@ -2234,6 +2236,7 @@ arc_buf_fill(arc_buf_t *buf, spa_t *spa, uint64_t dsobj, arc_fill_flags_t flags) "hdr %p, compress %d, psize %d, lsize %d", hdr, arc_hdr_get_compress(hdr), HDR_GET_PSIZE(hdr), HDR_GET_LSIZE(hdr)); + arc_hdr_set_flags(hdr, ARC_FLAG_IO_ERROR); return (SET_ERROR(EIO)); } } @@ -5815,7 +5818,9 @@ arc_read_done(zio_t *zio) acb->acb_compressed, acb->acb_noauth, B_TRUE, &acb->acb_buf); if (error != 0) { - arc_buf_destroy(acb->acb_buf, acb->acb_private); + (void) remove_reference(hdr, hash_lock, + acb->acb_private); + arc_buf_destroy_impl(acb->acb_buf); acb->acb_buf = NULL; } @@ -6058,7 +6063,9 @@ top: spa, NULL, zb, NULL, 0, 0); } if (rc != 0) { - arc_buf_destroy(buf, private); + (void) remove_reference(hdr, hash_lock, + private); + arc_buf_destroy_impl(buf); buf = NULL; } |