slub: Allow removal of slab caches during boot
authorChristoph Lameter <cl@linux-foundation.org>
Fri, 9 Jul 2010 19:07:13 +0000 (14:07 -0500)
committerPekka Enberg <penberg@cs.helsinki.fi>
Fri, 16 Jul 2010 08:13:07 +0000 (11:13 +0300)
If a slab cache is removed before we have setup sysfs then simply skip over
the sysfs handling.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Roland Dreier <rdreier@cisco.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Christoph Lameter <cl@linux-foundation.org>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
mm/slub.c

index 8655be5b7404982cf153c623af445f0e20966db3..b89a7c99b2fad518cffcfc68b0fd82f2135c9183 100644 (file)
--- 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);