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 Aug 9, 2024
1 parent 9621596 commit e9338e4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions module/zfs/arc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1787,10 +1787,13 @@ arc_hdr_authenticate(arc_buf_hdr_t *hdr, spa_t *spa, uint64_t dsobj)
!HDR_COMPRESSION_ENABLED(hdr)) {

csize = zio_compress_data(HDR_GET_COMPRESS(hdr),
hdr->b_l1hdr.b_pabd, &tmpbuf, lsize, lsize,
hdr->b_l1hdr.b_pabd, &tmpbuf, lsize, MIN(lsize, psize),
hdr->b_complevel);
if (csize >= lsize || csize > psize) {
ret = SET_ERROR(EIO);
goto error;
}
ASSERT3P(tmpbuf, !=, NULL);
ASSERT3U(csize, <=, psize);
abd = abd_get_from_buf(tmpbuf, lsize);
abd_take_ownership_of_buf(abd, B_TRUE);
abd_zero_off(abd, csize, psize - csize);
Expand Down

0 comments on commit e9338e4

Please sign in to comment.