Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d629d819 authored by Pekka Enberg's avatar Pekka Enberg
Browse files

slub: improve kmem_cache_destroy() error message



As pointed out by Ingo, the SLUB warning of calling kmem_cache_destroy()
with cache that still has objects triggers in practice. So turn this
WARN_ON() into a nice SLUB specific error message to avoid people
confusing it to a SLUB bug.

Cc: Ingo Molnar <mingo@elte.hu>
Acked-by: default avatarChristoph Lameter <clameter@sgi.com>
Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
parent 0701a9e6
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -2426,8 +2426,11 @@ void kmem_cache_destroy(struct kmem_cache *s)
	if (!s->refcount) {
	if (!s->refcount) {
		list_del(&s->list);
		list_del(&s->list);
		up_write(&slub_lock);
		up_write(&slub_lock);
		if (kmem_cache_close(s))
		if (kmem_cache_close(s)) {
			WARN_ON(1);
			printk(KERN_ERR "SLUB %s: %s called for cache that "
				"still has objects.\n", s->name, __func__);
			dump_stack();
		}
		sysfs_slab_remove(s);
		sysfs_slab_remove(s);
	} else
	} else
		up_write(&slub_lock);
		up_write(&slub_lock);