arc_hdr_authenticate: make explicit error

On compression we could be more explicit here for cases
where we can not recompress the data.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Co-authored-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: George Melikov <mail@gmelikov.ru>
Closes #9416
This commit is contained in:
George Melikov 2024-06-03 20:40:25 +03:00 committed by Brian Behlendorf
parent b32d48a625
commit 01852ffbf8
1 changed files with 6 additions and 2 deletions

View File

@ -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;
}