From 2763308887088708176584204d5acb795c03ebf6 Mon Sep 17 00:00:00 2001 From: bmilekic Date: Wed, 25 Jun 2003 17:25:45 +0000 Subject: [PATCH] Make sure that the zone destructor doesn't get called twice in certain free paths. --- sys/vm/uma_core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index ac86b27e2ccd..a60224957507 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -1671,8 +1671,10 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata) uma_bucket_t bucket; int bflags; int cpu; + int skip; /* This is the fast path free */ + skip = 0; #ifdef UMA_DEBUG_ALLOC_1 printf("Freeing item %p to %s(%p)\n", item, zone->uz_name, zone); #endif @@ -1684,8 +1686,10 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata) if (zone->uz_flags & UMA_ZFLAG_FULL) goto zfree_internal; - if (zone->uz_dtor) + if (zone->uz_dtor) { zone->uz_dtor(item, zone->uz_size, udata); + skip = 1; + } zfree_restart: cpu = PCPU_GET(cpuid); @@ -1800,7 +1804,7 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata) zfree_internal: - uma_zfree_internal(zone, item, udata, 0); + uma_zfree_internal(zone, item, udata, skip); return;