mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
devtmpfs: Convert dirlock to a mutex
devtmpfs has a rw_lock dirlock which serializes delete_path and create_path. This code was obviously never tested with the usual set of debugging facilities enabled. In the dirlock held sections the code calls: - vfs functions which take mutexes - kmalloc(, GFP_KERNEL) In both code pathes the might sleep warning triggers and spams dmesg. Convert the rw_lock to a mutex. There is no reason why this needs to be a rwlock. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
f42ecb2808
commit
f1f76f865b
1 changed files with 5 additions and 7 deletions
|
@ -32,7 +32,7 @@ static int dev_mount = 1;
|
||||||
static int dev_mount;
|
static int dev_mount;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static rwlock_t dirlock;
|
static DEFINE_MUTEX(dirlock);
|
||||||
|
|
||||||
static int __init mount_param(char *str)
|
static int __init mount_param(char *str)
|
||||||
{
|
{
|
||||||
|
@ -93,7 +93,7 @@ static int create_path(const char *nodepath)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
read_lock(&dirlock);
|
mutex_lock(&dirlock);
|
||||||
err = dev_mkdir(nodepath, 0755);
|
err = dev_mkdir(nodepath, 0755);
|
||||||
if (err == -ENOENT) {
|
if (err == -ENOENT) {
|
||||||
char *path;
|
char *path;
|
||||||
|
@ -117,7 +117,7 @@ static int create_path(const char *nodepath)
|
||||||
}
|
}
|
||||||
kfree(path);
|
kfree(path);
|
||||||
}
|
}
|
||||||
read_unlock(&dirlock);
|
mutex_unlock(&dirlock);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ static int delete_path(const char *nodepath)
|
||||||
if (!path)
|
if (!path)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
write_lock(&dirlock);
|
mutex_lock(&dirlock);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
char *base;
|
char *base;
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ static int delete_path(const char *nodepath)
|
||||||
if (err)
|
if (err)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
write_unlock(&dirlock);
|
mutex_unlock(&dirlock);
|
||||||
|
|
||||||
kfree(path);
|
kfree(path);
|
||||||
return err;
|
return err;
|
||||||
|
@ -352,8 +352,6 @@ int __init devtmpfs_init(void)
|
||||||
int err;
|
int err;
|
||||||
struct vfsmount *mnt;
|
struct vfsmount *mnt;
|
||||||
|
|
||||||
rwlock_init(&dirlock);
|
|
||||||
|
|
||||||
err = register_filesystem(&dev_fs_type);
|
err = register_filesystem(&dev_fs_type);
|
||||||
if (err) {
|
if (err) {
|
||||||
printk(KERN_ERR "devtmpfs: unable to register devtmpfs "
|
printk(KERN_ERR "devtmpfs: unable to register devtmpfs "
|
||||||
|
|
Loading…
Reference in a new issue