dm crypt: fix cpu hotplug crash by removing per-cpu structure
[linux-2.6-block.git] / mm / slab_common.c
index f3cfccf76dda693250106d3c8d0387292e741c14..102cc6fca3d393f374984a7628d644b99b629a54 100644 (file)
@@ -323,6 +323,12 @@ static int kmem_cache_destroy_memcg_children(struct kmem_cache *s)
 }
 #endif /* CONFIG_MEMCG_KMEM */
 
+void slab_kmem_cache_release(struct kmem_cache *s)
+{
+       kfree(s->name);
+       kmem_cache_free(kmem_cache, s);
+}
+
 void kmem_cache_destroy(struct kmem_cache *s)
 {
        get_online_cpus();
@@ -352,8 +358,11 @@ void kmem_cache_destroy(struct kmem_cache *s)
                rcu_barrier();
 
        memcg_free_cache_params(s);
-       kfree(s->name);
-       kmem_cache_free(kmem_cache, s);
+#ifdef SLAB_SUPPORTS_SYSFS
+       sysfs_slab_remove(s);
+#else
+       slab_kmem_cache_release(s);
+#endif
        goto out_put_cpus;
 
 out_unlock: