From: Christoph Lameter Date: Fri, 9 Jul 2010 19:07:13 +0000 (-0500) Subject: slub: Allow removal of slab caches during boot X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=f5b801ac38a9612b380ee9a75ab1861f0594e79f;p=deliverable%2Flinux.git slub: Allow removal of slab caches during boot If a slab cache is removed before we have setup sysfs then simply skip over the sysfs handling. Cc: Benjamin Herrenschmidt Cc: Roland Dreier Acked-by: David Rientjes Signed-off-by: Christoph Lameter Signed-off-by: Pekka Enberg --- diff --git a/mm/slub.c b/mm/slub.c index 8655be5b7404..b89a7c99b2fa 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4507,6 +4507,13 @@ static int sysfs_slab_add(struct kmem_cache *s) static void sysfs_slab_remove(struct kmem_cache *s) { + if (slab_state < SYSFS) + /* + * Sysfs has not been setup yet so no need to remove the + * cache from sysfs. + */ + return; + kobject_uevent(&s->kobj, KOBJ_REMOVE); kobject_del(&s->kobj); kobject_put(&s->kobj);