Fix a INVARIANTS-only bug introduced in Revision 1.104:

IF INVARIANTS is defined, and in the rare case that we have
allocated some objects from the slab and at least one initializer
on at least one of those objects failed, and we need to fail the
allocation and push the uninitialized items back into the slab
caches -- in that scenario, we would fail to [re]set the
bucket cache's ub_bucket item references to NULL, which would
eventually trigger a KASSERT.
This commit is contained in:
bmilekic 2004-10-27 21:19:35 +00:00
parent 26ee4cc617
commit 13ebdd218a

View File

@ -2093,9 +2093,13 @@ uma_zalloc_bucket(uma_zone_t zone, int flags)
if (i != bucket->ub_cnt) {
int j;
for (j = i; j < bucket->ub_cnt; j++)
for (j = i; j < bucket->ub_cnt; j++) {
uma_zfree_internal(zone, bucket->ub_bucket[j],
NULL, SKIP_FINI);
#ifdef INVARIANTS
bucket->ub_bucket[j] = NULL;
#endif
}
bucket->ub_cnt = i;
}
ZONE_LOCK(zone);