Fix ZFS_DEBUG_MODIFY assert in arc_buf_try_copy_decompressed_data
The assert does not account for the case where there is a single buffer in the chain that is decompressed and has a valid checksum. Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
This commit is contained in:
parent
23f878a89d
commit
ae78a23f75
|
@ -1701,6 +1701,7 @@ arc_buf_try_copy_decompressed_data(arc_buf_t *buf)
|
||||||
{
|
{
|
||||||
arc_buf_hdr_t *hdr = buf->b_hdr;
|
arc_buf_hdr_t *hdr = buf->b_hdr;
|
||||||
boolean_t copied = B_FALSE;
|
boolean_t copied = B_FALSE;
|
||||||
|
int nbufs = 0;
|
||||||
|
|
||||||
ASSERT(HDR_HAS_L1HDR(hdr));
|
ASSERT(HDR_HAS_L1HDR(hdr));
|
||||||
ASSERT3P(buf->b_data, !=, NULL);
|
ASSERT3P(buf->b_data, !=, NULL);
|
||||||
|
@ -1712,7 +1713,7 @@ arc_buf_try_copy_decompressed_data(arc_buf_t *buf)
|
||||||
if (from == buf) {
|
if (from == buf) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
nbufs++;
|
||||||
if (!ARC_BUF_COMPRESSED(from)) {
|
if (!ARC_BUF_COMPRESSED(from)) {
|
||||||
memcpy(buf->b_data, from->b_data, arc_buf_size(buf));
|
memcpy(buf->b_data, from->b_data, arc_buf_size(buf));
|
||||||
copied = B_TRUE;
|
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
|
* There were no decompressed bufs, so there should not be a
|
||||||
* checksum on the hdr either.
|
* checksum on the hdr either.
|
||||||
*/
|
*/
|
||||||
if (zfs_flags & ZFS_DEBUG_MODIFY)
|
if (zfs_flags & ZFS_DEBUG_MODIFY) {
|
||||||
EQUIV(!copied, hdr->b_l1hdr.b_freeze_cksum == NULL);
|
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
|
#endif
|
||||||
|
|
||||||
return (copied);
|
return (copied);
|
||||||
|
|
Loading…
Reference in New Issue