arc_hdr_authenticate: make explicit error
On compression we could be more explicit here for cases where we can not recompress the data. Co-authored-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: George Melikov <mail@gmelikov.ru>
This commit is contained in:
parent
263bbe99f9
commit
5737823d0f
|
@ -1787,9 +1787,13 @@ arc_hdr_authenticate(arc_buf_hdr_t *hdr, spa_t *spa, uint64_t dsobj)
|
||||||
!HDR_COMPRESSION_ENABLED(hdr)) {
|
!HDR_COMPRESSION_ENABLED(hdr)) {
|
||||||
abd = NULL;
|
abd = NULL;
|
||||||
csize = zio_compress_data(HDR_GET_COMPRESS(hdr),
|
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);
|
ASSERT3P(abd, !=, NULL);
|
||||||
ASSERT3U(csize, <=, psize);
|
|
||||||
abd_zero_off(abd, csize, psize - csize);
|
abd_zero_off(abd, csize, psize - csize);
|
||||||
free_abd = B_TRUE;
|
free_abd = B_TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue