zfs: Fix positive ABD size assertion in abd_verify().
This cherry-picks upstream:
commit bba7cbf0a4
Author: Alexander Motin <mav@FreeBSD.org>
Date: Wed Apr 26 12:20:43 2023 -0400
Fix positive ABD size assertion in abd_verify().
Gang ABDs without childred are legal, and they do have zero size.
For other ABD types zero size doesn't have much sense and likely
not working correctly now.
Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #14795
Sponsored by: Rubicon Communications, LLC ("Netgate")
This commit is contained in:
parent
b73183d1a2
commit
d09a955a60
@ -109,7 +109,6 @@ void
|
|||||||
abd_verify(abd_t *abd)
|
abd_verify(abd_t *abd)
|
||||||
{
|
{
|
||||||
#ifdef ZFS_DEBUG
|
#ifdef ZFS_DEBUG
|
||||||
ASSERT3U(abd->abd_size, >, 0);
|
|
||||||
ASSERT3U(abd->abd_size, <=, SPA_MAXBLOCKSIZE);
|
ASSERT3U(abd->abd_size, <=, SPA_MAXBLOCKSIZE);
|
||||||
ASSERT3U(abd->abd_flags, ==, abd->abd_flags & (ABD_FLAG_LINEAR |
|
ASSERT3U(abd->abd_flags, ==, abd->abd_flags & (ABD_FLAG_LINEAR |
|
||||||
ABD_FLAG_OWNER | ABD_FLAG_META | ABD_FLAG_MULTI_ZONE |
|
ABD_FLAG_OWNER | ABD_FLAG_META | ABD_FLAG_MULTI_ZONE |
|
||||||
@ -118,6 +117,7 @@ abd_verify(abd_t *abd)
|
|||||||
IMPLY(abd->abd_parent != NULL, !(abd->abd_flags & ABD_FLAG_OWNER));
|
IMPLY(abd->abd_parent != NULL, !(abd->abd_flags & ABD_FLAG_OWNER));
|
||||||
IMPLY(abd->abd_flags & ABD_FLAG_META, abd->abd_flags & ABD_FLAG_OWNER);
|
IMPLY(abd->abd_flags & ABD_FLAG_META, abd->abd_flags & ABD_FLAG_OWNER);
|
||||||
if (abd_is_linear(abd)) {
|
if (abd_is_linear(abd)) {
|
||||||
|
ASSERT3U(abd->abd_size, >, 0);
|
||||||
ASSERT3P(ABD_LINEAR_BUF(abd), !=, NULL);
|
ASSERT3P(ABD_LINEAR_BUF(abd), !=, NULL);
|
||||||
} else if (abd_is_gang(abd)) {
|
} else if (abd_is_gang(abd)) {
|
||||||
uint_t child_sizes = 0;
|
uint_t child_sizes = 0;
|
||||||
@ -130,6 +130,7 @@ abd_verify(abd_t *abd)
|
|||||||
}
|
}
|
||||||
ASSERT3U(abd->abd_size, ==, child_sizes);
|
ASSERT3U(abd->abd_size, ==, child_sizes);
|
||||||
} else {
|
} else {
|
||||||
|
ASSERT3U(abd->abd_size, >, 0);
|
||||||
abd_verify_scatter(abd);
|
abd_verify_scatter(abd);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user