From: Sepherosa Ziehau Date: Fri, 26 Dec 2008 12:40:34 +0000 (+0800) Subject: We need to restore unallocated_objects if objcache alloc fails. X-Git-Tag: v2.3.0~209 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/8d968f1d34d7f672c6bda28d5a6c71f93bba1c2c We need to restore unallocated_objects if objcache alloc fails. Reviewed-by: dillon@ --- diff --git a/sys/kern/kern_objcache.c b/sys/kern/kern_objcache.c index 20b8c43814..5a4cc7f448 100644 --- a/sys/kern/kern_objcache.c +++ b/sys/kern/kern_objcache.c @@ -432,14 +432,15 @@ retry: if (oc->ctor(obj, oc->privdata, ocflags)) return (obj); oc->free(obj, oc->allocator_args); + obj = NULL; + } + if (obj == NULL) { spin_lock_wr(&depot->spin); ++depot->unallocated_objects; spin_unlock_wr(&depot->spin); if (depot->waiting) wakeup(depot); - obj = NULL; - } - if (obj == NULL) { + crit_enter(); /* * makes debugging easier when gets_cumulative does