Commit 1d5599e3 authored by Ingo Molnar's avatar Ingo Molnar Committed by Linus Torvalds

[PATCH] sem2mutex: autofs4 wq_sem

Semaphore to mutex conversion.

The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Acked-by: default avatarIan Kent <raven@themaw.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1eb0d670
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
/* Internal header file for autofs */ /* Internal header file for autofs */
#include <linux/auto_fs4.h> #include <linux/auto_fs4.h>
#include <linux/mutex.h>
#include <linux/list.h> #include <linux/list.h>
/* This is the range of ioctl() numbers we claim as ours */ /* This is the range of ioctl() numbers we claim as ours */
...@@ -102,7 +103,7 @@ struct autofs_sb_info { ...@@ -102,7 +103,7 @@ struct autofs_sb_info {
int reghost_enabled; int reghost_enabled;
int needs_reghost; int needs_reghost;
struct super_block *sb; struct super_block *sb;
struct semaphore wq_sem; struct mutex wq_mutex;
spinlock_t fs_lock; spinlock_t fs_lock;
struct autofs_wait_queue *queues; /* Wait queue pointer */ struct autofs_wait_queue *queues; /* Wait queue pointer */
}; };
......
...@@ -269,7 +269,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) ...@@ -269,7 +269,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
sbi->sb = s; sbi->sb = s;
sbi->version = 0; sbi->version = 0;
sbi->sub_version = 0; sbi->sub_version = 0;
init_MUTEX(&sbi->wq_sem); mutex_init(&sbi->wq_mutex);
spin_lock_init(&sbi->fs_lock); spin_lock_init(&sbi->fs_lock);
sbi->queues = NULL; sbi->queues = NULL;
s->s_blocksize = 1024; s->s_blocksize = 1024;
......
...@@ -178,7 +178,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, ...@@ -178,7 +178,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
return -ENOENT; return -ENOENT;
} }
if (down_interruptible(&sbi->wq_sem)) { if (mutex_lock_interruptible(&sbi->wq_mutex)) {
kfree(name); kfree(name);
return -EINTR; return -EINTR;
} }
...@@ -194,7 +194,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, ...@@ -194,7 +194,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
/* Can't wait for an expire if there's no mount */ /* Can't wait for an expire if there's no mount */
if (notify == NFY_NONE && !d_mountpoint(dentry)) { if (notify == NFY_NONE && !d_mountpoint(dentry)) {
kfree(name); kfree(name);
up(&sbi->wq_sem); mutex_unlock(&sbi->wq_mutex);
return -ENOENT; return -ENOENT;
} }
...@@ -202,7 +202,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, ...@@ -202,7 +202,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL); wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL);
if ( !wq ) { if ( !wq ) {
kfree(name); kfree(name);
up(&sbi->wq_sem); mutex_unlock(&sbi->wq_mutex);
return -ENOMEM; return -ENOMEM;
} }
...@@ -218,10 +218,10 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, ...@@ -218,10 +218,10 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
wq->status = -EINTR; /* Status return if interrupted */ wq->status = -EINTR; /* Status return if interrupted */
atomic_set(&wq->wait_ctr, 2); atomic_set(&wq->wait_ctr, 2);
atomic_set(&wq->notified, 1); atomic_set(&wq->notified, 1);
up(&sbi->wq_sem); mutex_unlock(&sbi->wq_mutex);
} else { } else {
atomic_inc(&wq->wait_ctr); atomic_inc(&wq->wait_ctr);
up(&sbi->wq_sem); mutex_unlock(&sbi->wq_mutex);
kfree(name); kfree(name);
DPRINTK("existing wait id = 0x%08lx, name = %.*s, nfy=%d", DPRINTK("existing wait id = 0x%08lx, name = %.*s, nfy=%d",
(unsigned long) wq->wait_queue_token, wq->len, wq->name, notify); (unsigned long) wq->wait_queue_token, wq->len, wq->name, notify);
...@@ -282,19 +282,19 @@ int autofs4_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_tok ...@@ -282,19 +282,19 @@ int autofs4_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_tok
{ {
struct autofs_wait_queue *wq, **wql; struct autofs_wait_queue *wq, **wql;
down(&sbi->wq_sem); mutex_lock(&sbi->wq_mutex);
for ( wql = &sbi->queues ; (wq = *wql) != 0 ; wql = &wq->next ) { for ( wql = &sbi->queues ; (wq = *wql) != 0 ; wql = &wq->next ) {
if ( wq->wait_queue_token == wait_queue_token ) if ( wq->wait_queue_token == wait_queue_token )
break; break;
} }
if ( !wq ) { if ( !wq ) {
up(&sbi->wq_sem); mutex_unlock(&sbi->wq_mutex);
return -EINVAL; return -EINVAL;
} }
*wql = wq->next; /* Unlink from chain */ *wql = wq->next; /* Unlink from chain */
up(&sbi->wq_sem); mutex_unlock(&sbi->wq_mutex);
kfree(wq->name); kfree(wq->name);
wq->name = NULL; /* Do not wait on this queue */ wq->name = NULL; /* Do not wait on this queue */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment