[PATCH] slab: Fix hang when creating sysfs entries

From: Sasha Levin
Date: Sun Jan 15 2012 - 07:55:03 EST


This patch fixes the hang which happens when we create a sysfs entry and call
back to userspace. If the usermode helper tries to do anything which involves
slub_lock we will hang since slub_lock is already held.

Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx>
---
mm/slub.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 4907563..6948327 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -5283,7 +5283,9 @@ static int sysfs_slab_add(struct kmem_cache *s)
kobject_put(&s->kobj);
return err;
}
+ up_write(&slub_lock);
kobject_uevent(&s->kobj, KOBJ_ADD);
+ down_write(&slub_lock);
if (!unmergeable) {
/* Setup first alias */
sysfs_slab_alias(s, s->name);
--
1.7.8.3


--

Sasha.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/