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.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Co-authored-by: Alexander Motin <[email protected]>
Signed-off-by: George Melikov <[email protected]>
Closes openzfs#9416
  • Loading branch information
gmelikov authored and ixhamza committed Nov 11, 2024
1 parent 4ecdf62 commit 3ace0a4
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 3ace0a4

Please sign in to comment.