diff options
author | Pekka Enberg <penberg@kernel.org> | 2012-09-05 05:07:44 -0400 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2012-09-05 05:07:44 -0400 |
commit | aac3a1664aba429f47c70edfc76ee10fcd808471 (patch) | |
tree | d4c00b488bcbe383ece4a545ced0f83db0b6167a | |
parent | cce89f4f6911286500cf7be0363f46c9b0a12ce0 (diff) |
Revert "mm/sl[aou]b: Move sysfs_slab_add to common"
This reverts commit 96d17b7be0a9849d381442030886211dbb2a7061 which
caused the following errors at boot:
[ 1.114885] kobject (ffff88001a802578): tried to init an initialized object, something is seriously wrong.
[ 1.114885] Pid: 1, comm: swapper/0 Tainted: G W 3.6.0-rc1+ #6
[ 1.114885] Call Trace:
[ 1.114885] [<ffffffff81273f37>] kobject_init+0x87/0xa0
[ 1.115555] [<ffffffff8127426a>] kobject_init_and_add+0x2a/0x90
[ 1.115555] [<ffffffff8127c870>] ? sprintf+0x40/0x50
[ 1.115555] [<ffffffff81124c60>] sysfs_slab_add+0x80/0x210
[ 1.115555] [<ffffffff81100175>] kmem_cache_create+0xa5/0x250
[ 1.115555] [<ffffffff81cf24cd>] ? md_init+0x144/0x144
[ 1.115555] [<ffffffff81cf25b6>] local_init+0xa4/0x11b
[ 1.115555] [<ffffffff81cf24e1>] dm_init+0x14/0x45
[ 1.115836] [<ffffffff810001ba>] do_one_initcall+0x3a/0x160
[ 1.116834] [<ffffffff81cc2c90>] kernel_init+0x133/0x1b7
[ 1.117835] [<ffffffff81cc25c4>] ? do_early_param+0x86/0x86
[ 1.117835] [<ffffffff8171aff4>] kernel_thread_helper+0x4/0x10
[ 1.118401] [<ffffffff81cc2b5d>] ? start_kernel+0x33f/0x33f
[ 1.119832] [<ffffffff8171aff0>] ? gs_change+0xb/0xb
[ 1.120325] ------------[ cut here ]------------
[ 1.120835] WARNING: at fs/sysfs/dir.c:536 sysfs_add_one+0xc1/0xf0()
[ 1.121437] sysfs: cannot create duplicate filename '/kernel/slab/:t-0000016'
[ 1.121831] Modules linked in:
[ 1.122138] Pid: 1, comm: swapper/0 Tainted: G W 3.6.0-rc1+ #6
[ 1.122831] Call Trace:
[ 1.123074] [<ffffffff81195ce1>] ? sysfs_add_one+0xc1/0xf0
[ 1.123833] [<ffffffff8103adfa>] warn_slowpath_common+0x7a/0xb0
[ 1.124405] [<ffffffff8103aed1>] warn_slowpath_fmt+0x41/0x50
[ 1.124832] [<ffffffff81195ce1>] sysfs_add_one+0xc1/0xf0
[ 1.125337] [<ffffffff81195eb3>] create_dir+0x73/0xd0
[ 1.125832] [<ffffffff81196221>] sysfs_create_dir+0x81/0xe0
[ 1.126363] [<ffffffff81273d3d>] kobject_add_internal+0x9d/0x210
[ 1.126832] [<ffffffff812742a3>] kobject_init_and_add+0x63/0x90
[ 1.127406] [<ffffffff81124c60>] sysfs_slab_add+0x80/0x210
[ 1.127832] [<ffffffff81100175>] kmem_cache_create+0xa5/0x250
[ 1.128384] [<ffffffff81cf24cd>] ? md_init+0x144/0x144
[ 1.128833] [<ffffffff81cf25b6>] local_init+0xa4/0x11b
[ 1.129831] [<ffffffff81cf24e1>] dm_init+0x14/0x45
[ 1.130305] [<ffffffff810001ba>] do_one_initcall+0x3a/0x160
[ 1.130831] [<ffffffff81cc2c90>] kernel_init+0x133/0x1b7
[ 1.131351] [<ffffffff81cc25c4>] ? do_early_param+0x86/0x86
[ 1.131830] [<ffffffff8171aff4>] kernel_thread_helper+0x4/0x10
[ 1.132392] [<ffffffff81cc2b5d>] ? start_kernel+0x33f/0x33f
[ 1.132830] [<ffffffff8171aff0>] ? gs_change+0xb/0xb
[ 1.133315] ---[ end trace 2703540871c8fab7 ]---
[ 1.133830] ------------[ cut here ]------------
[ 1.134274] WARNING: at lib/kobject.c:196 kobject_add_internal+0x1f5/0x210()
[ 1.134829] kobject_add_internal failed for :t-0000016 with -EEXIST, don't try to register things with the same name in the same directory.
[ 1.135829] Modules linked in:
[ 1.136135] Pid: 1, comm: swapper/0 Tainted: G W 3.6.0-rc1+ #6
[ 1.136828] Call Trace:
[ 1.137071] [<ffffffff81273e95>] ? kobject_add_internal+0x1f5/0x210
[ 1.137830] [<ffffffff8103adfa>] warn_slowpath_common+0x7a/0xb0
[ 1.138402] [<ffffffff8103aed1>] warn_slowpath_fmt+0x41/0x50
[ 1.138830] [<ffffffff811955a3>] ? release_sysfs_dirent+0x73/0xf0
[ 1.139419] [<ffffffff81273e95>] kobject_add_internal+0x1f5/0x210
[ 1.139830] [<ffffffff812742a3>] kobject_init_and_add+0x63/0x90
[ 1.140429] [<ffffffff81124c60>] sysfs_slab_add+0x80/0x210
[ 1.140830] [<ffffffff81100175>] kmem_cache_create+0xa5/0x250
[ 1.141829] [<ffffffff81cf24cd>] ? md_init+0x144/0x144
[ 1.142307] [<ffffffff81cf25b6>] local_init+0xa4/0x11b
[ 1.142829] [<ffffffff81cf24e1>] dm_init+0x14/0x45
[ 1.143307] [<ffffffff810001ba>] do_one_initcall+0x3a/0x160
[ 1.143829] [<ffffffff81cc2c90>] kernel_init+0x133/0x1b7
[ 1.144352] [<ffffffff81cc25c4>] ? do_early_param+0x86/0x86
[ 1.144829] [<ffffffff8171aff4>] kernel_thread_helper+0x4/0x10
[ 1.145405] [<ffffffff81cc2b5d>] ? start_kernel+0x33f/0x33f
[ 1.145828] [<ffffffff8171aff0>] ? gs_change+0xb/0xb
[ 1.146313] ---[ end trace 2703540871c8fab8 ]---
Conflicts:
mm/slub.c
Signed-off-by: Pekka Enberg <penberg@kernel.org>
-rw-r--r-- | mm/slab.h | 3 | ||||
-rw-r--r-- | mm/slab_common.c | 8 | ||||
-rw-r--r-- | mm/slub.c | 19 |
3 files changed, 17 insertions, 13 deletions
@@ -38,13 +38,10 @@ extern int __kmem_cache_create(struct kmem_cache *, unsigned long flags); | |||
38 | #ifdef CONFIG_SLUB | 38 | #ifdef CONFIG_SLUB |
39 | struct kmem_cache *__kmem_cache_alias(const char *name, size_t size, | 39 | struct kmem_cache *__kmem_cache_alias(const char *name, size_t size, |
40 | size_t align, unsigned long flags, void (*ctor)(void *)); | 40 | size_t align, unsigned long flags, void (*ctor)(void *)); |
41 | extern int sysfs_slab_add(struct kmem_cache *s); | ||
42 | #else | 41 | #else |
43 | static inline struct kmem_cache *__kmem_cache_alias(const char *name, size_t size, | 42 | static inline struct kmem_cache *__kmem_cache_alias(const char *name, size_t size, |
44 | size_t align, unsigned long flags, void (*ctor)(void *)) | 43 | size_t align, unsigned long flags, void (*ctor)(void *)) |
45 | { return NULL; } | 44 | { return NULL; } |
46 | static inline int sysfs_slab_add(struct kmem_cache *s) { return 0; } | ||
47 | |||
48 | #endif | 45 | #endif |
49 | 46 | ||
50 | 47 | ||
diff --git a/mm/slab_common.c b/mm/slab_common.c index 651a3c60847a..9c217255ac49 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c | |||
@@ -155,14 +155,6 @@ out_locked: | |||
155 | return NULL; | 155 | return NULL; |
156 | } | 156 | } |
157 | 157 | ||
158 | if (s->refcount == 1) { | ||
159 | err = sysfs_slab_add(s); | ||
160 | if (err) | ||
161 | printk(KERN_WARNING "kmem_cache_create(%s) failed to" | ||
162 | " create sysfs entry. Error %d\n", | ||
163 | name, err); | ||
164 | } | ||
165 | |||
166 | return s; | 158 | return s; |
167 | } | 159 | } |
168 | EXPORT_SYMBOL(kmem_cache_create); | 160 | EXPORT_SYMBOL(kmem_cache_create); |
@@ -202,10 +202,12 @@ struct track { | |||
202 | enum track_item { TRACK_ALLOC, TRACK_FREE }; | 202 | enum track_item { TRACK_ALLOC, TRACK_FREE }; |
203 | 203 | ||
204 | #ifdef CONFIG_SYSFS | 204 | #ifdef CONFIG_SYSFS |
205 | static int sysfs_slab_add(struct kmem_cache *); | ||
205 | static int sysfs_slab_alias(struct kmem_cache *, const char *); | 206 | static int sysfs_slab_alias(struct kmem_cache *, const char *); |
206 | static void sysfs_slab_remove(struct kmem_cache *); | 207 | static void sysfs_slab_remove(struct kmem_cache *); |
207 | 208 | ||
208 | #else | 209 | #else |
210 | static inline int sysfs_slab_add(struct kmem_cache *s) { return 0; } | ||
209 | static inline int sysfs_slab_alias(struct kmem_cache *s, const char *p) | 211 | static inline int sysfs_slab_alias(struct kmem_cache *s, const char *p) |
210 | { return 0; } | 212 | { return 0; } |
211 | static inline void sysfs_slab_remove(struct kmem_cache *s) { } | 213 | static inline void sysfs_slab_remove(struct kmem_cache *s) { } |
@@ -3943,7 +3945,20 @@ struct kmem_cache *__kmem_cache_alias(const char *name, size_t size, | |||
3943 | 3945 | ||
3944 | int __kmem_cache_create(struct kmem_cache *s, unsigned long flags) | 3946 | int __kmem_cache_create(struct kmem_cache *s, unsigned long flags) |
3945 | { | 3947 | { |
3946 | return kmem_cache_open(s, flags); | 3948 | int err; |
3949 | |||
3950 | err = kmem_cache_open(s, flags); | ||
3951 | if (err) | ||
3952 | return err; | ||
3953 | |||
3954 | mutex_unlock(&slab_mutex); | ||
3955 | err = sysfs_slab_add(s); | ||
3956 | mutex_lock(&slab_mutex); | ||
3957 | |||
3958 | if (err) | ||
3959 | kmem_cache_close(s); | ||
3960 | |||
3961 | return err; | ||
3947 | } | 3962 | } |
3948 | 3963 | ||
3949 | #ifdef CONFIG_SMP | 3964 | #ifdef CONFIG_SMP |
@@ -5233,7 +5248,7 @@ static char *create_unique_id(struct kmem_cache *s) | |||
5233 | return name; | 5248 | return name; |
5234 | } | 5249 | } |
5235 | 5250 | ||
5236 | int sysfs_slab_add(struct kmem_cache *s) | 5251 | static int sysfs_slab_add(struct kmem_cache *s) |
5237 | { | 5252 | { |
5238 | int err; | 5253 | int err; |
5239 | const char *name; | 5254 | const char *name; |