diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 7023f44818..38d0909183 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -1701,6 +1701,7 @@ arc_buf_try_copy_decompressed_data(arc_buf_t *buf) { arc_buf_hdr_t *hdr = buf->b_hdr; boolean_t copied = B_FALSE; + int nbufs = 0; ASSERT(HDR_HAS_L1HDR(hdr)); ASSERT3P(buf->b_data, !=, NULL); @@ -1712,7 +1713,7 @@ arc_buf_try_copy_decompressed_data(arc_buf_t *buf) if (from == buf) { continue; } - + nbufs++; if (!ARC_BUF_COMPRESSED(from)) { memcpy(buf->b_data, from->b_data, arc_buf_size(buf)); copied = B_TRUE; @@ -1725,8 +1726,18 @@ arc_buf_try_copy_decompressed_data(arc_buf_t *buf) * There were no decompressed bufs, so there should not be a * checksum on the hdr either. */ - if (zfs_flags & ZFS_DEBUG_MODIFY) - EQUIV(!copied, hdr->b_l1hdr.b_freeze_cksum == NULL); + if (zfs_flags & ZFS_DEBUG_MODIFY) { + if (nbufs) + EQUIV(!copied, hdr->b_l1hdr.b_freeze_cksum == NULL); + else if (!ARC_BUF_COMPRESSED(buf) && + hdr->b_l1hdr.b_freeze_cksum != NULL) { + zio_cksum_t cksum; + fletcher_2_native(buf->b_data, arc_buf_size(buf), NULL, + &cksum); + ASSERT0(memcmp(&cksum, hdr->b_l1hdr.b_freeze_cksum, + sizeof (zio_cksum_t))); + } + } #endif return (copied);