Skip to content

Commit

Permalink
arc_hdr_authenticate: make explicit error
Browse files Browse the repository at this point in the history
On compression we could be more explicit here for cases
where we can not recompress the data.

Co-authored-by: Alexander Motin <[email protected]>
Signed-off-by: George Melikov <[email protected]>
  • Loading branch information
gmelikov and amotin committed Sep 19, 2024
1 parent caa6588 commit c12ed0d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions module/zfs/arc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1787,9 +1787,13 @@ arc_hdr_authenticate(arc_buf_hdr_t *hdr, spa_t *spa, uint64_t dsobj)
!HDR_COMPRESSION_ENABLED(hdr)) {
abd = NULL;
csize = zio_compress_data(HDR_GET_COMPRESS(hdr),
hdr->b_l1hdr.b_pabd, &abd, lsize, lsize, hdr->b_complevel);
hdr->b_l1hdr.b_pabd, &abd, lsize, MIN(lsize, psize),
hdr->b_complevel);
if (csize >= lsize || csize > psize) {
ret = SET_ERROR(EIO);
return (ret);
}
ASSERT3P(abd, !=, NULL);
ASSERT3U(csize, <=, psize);
abd_zero_off(abd, csize, psize - csize);
free_abd = B_TRUE;
}
Expand Down

0 comments on commit c12ed0d

Please sign in to comment.