diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-23 06:00:41 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-23 10:38:13 -0500 |
commit | 1d5599e397dcc7c2300d200e66dad326d7dbac38 (patch) | |
tree | beaa29f23c35375bbff4b5b256e96dd3b13c5728 | |
parent | 1eb0d67007e75697a7b87e6b611be935a991395c (diff) |
[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: Ingo Molnar <mingo@elte.hu>
Acked-by: Ian Kent <raven@themaw.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/autofs4/autofs_i.h | 3 | ||||
-rw-r--r-- | fs/autofs4/inode.c | 2 | ||||
-rw-r--r-- | fs/autofs4/waitq.c | 16 |
3 files changed, 11 insertions, 10 deletions
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h index 385bed09b0d8..f54c5b21f876 100644 --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h | |||
@@ -13,6 +13,7 @@ | |||
13 | /* Internal header file for autofs */ | 13 | /* Internal header file for autofs */ |
14 | 14 | ||
15 | #include <linux/auto_fs4.h> | 15 | #include <linux/auto_fs4.h> |
16 | #include <linux/mutex.h> | ||
16 | #include <linux/list.h> | 17 | #include <linux/list.h> |
17 | 18 | ||
18 | /* This is the range of ioctl() numbers we claim as ours */ | 19 | /* This is the range of ioctl() numbers we claim as ours */ |
@@ -102,7 +103,7 @@ struct autofs_sb_info { | |||
102 | int reghost_enabled; | 103 | int reghost_enabled; |
103 | int needs_reghost; | 104 | int needs_reghost; |
104 | struct super_block *sb; | 105 | struct super_block *sb; |
105 | struct semaphore wq_sem; | 106 | struct mutex wq_mutex; |
106 | spinlock_t fs_lock; | 107 | spinlock_t fs_lock; |
107 | struct autofs_wait_queue *queues; /* Wait queue pointer */ | 108 | struct autofs_wait_queue *queues; /* Wait queue pointer */ |
108 | }; | 109 | }; |
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index 2d3082854a29..1ad98d48e550 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c | |||
@@ -269,7 +269,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
269 | sbi->sb = s; | 269 | sbi->sb = s; |
270 | sbi->version = 0; | 270 | sbi->version = 0; |
271 | sbi->sub_version = 0; | 271 | sbi->sub_version = 0; |
272 | init_MUTEX(&sbi->wq_sem); | 272 | mutex_init(&sbi->wq_mutex); |
273 | spin_lock_init(&sbi->fs_lock); | 273 | spin_lock_init(&sbi->fs_lock); |
274 | sbi->queues = NULL; | 274 | sbi->queues = NULL; |
275 | s->s_blocksize = 1024; | 275 | s->s_blocksize = 1024; |
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index 394ff36ef8f1..be78e9378c03 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c | |||
@@ -178,7 +178,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, | |||
178 | return -ENOENT; | 178 | return -ENOENT; |
179 | } | 179 | } |
180 | 180 | ||
181 | if (down_interruptible(&sbi->wq_sem)) { | 181 | if (mutex_lock_interruptible(&sbi->wq_mutex)) { |
182 | kfree(name); | 182 | kfree(name); |
183 | return -EINTR; | 183 | return -EINTR; |
184 | } | 184 | } |
@@ -194,7 +194,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, | |||
194 | /* Can't wait for an expire if there's no mount */ | 194 | /* Can't wait for an expire if there's no mount */ |
195 | if (notify == NFY_NONE && !d_mountpoint(dentry)) { | 195 | if (notify == NFY_NONE && !d_mountpoint(dentry)) { |
196 | kfree(name); | 196 | kfree(name); |
197 | up(&sbi->wq_sem); | 197 | mutex_unlock(&sbi->wq_mutex); |
198 | return -ENOENT; | 198 | return -ENOENT; |
199 | } | 199 | } |
200 | 200 | ||
@@ -202,7 +202,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, | |||
202 | wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL); | 202 | wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL); |
203 | if ( !wq ) { | 203 | if ( !wq ) { |
204 | kfree(name); | 204 | kfree(name); |
205 | up(&sbi->wq_sem); | 205 | mutex_unlock(&sbi->wq_mutex); |
206 | return -ENOMEM; | 206 | return -ENOMEM; |
207 | } | 207 | } |
208 | 208 | ||
@@ -218,10 +218,10 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, | |||
218 | wq->status = -EINTR; /* Status return if interrupted */ | 218 | wq->status = -EINTR; /* Status return if interrupted */ |
219 | atomic_set(&wq->wait_ctr, 2); | 219 | atomic_set(&wq->wait_ctr, 2); |
220 | atomic_set(&wq->notified, 1); | 220 | atomic_set(&wq->notified, 1); |
221 | up(&sbi->wq_sem); | 221 | mutex_unlock(&sbi->wq_mutex); |
222 | } else { | 222 | } else { |
223 | atomic_inc(&wq->wait_ctr); | 223 | atomic_inc(&wq->wait_ctr); |
224 | up(&sbi->wq_sem); | 224 | mutex_unlock(&sbi->wq_mutex); |
225 | kfree(name); | 225 | kfree(name); |
226 | DPRINTK("existing wait id = 0x%08lx, name = %.*s, nfy=%d", | 226 | DPRINTK("existing wait id = 0x%08lx, name = %.*s, nfy=%d", |
227 | (unsigned long) wq->wait_queue_token, wq->len, wq->name, notify); | 227 | (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 | { | 282 | { |
283 | struct autofs_wait_queue *wq, **wql; | 283 | struct autofs_wait_queue *wq, **wql; |
284 | 284 | ||
285 | down(&sbi->wq_sem); | 285 | mutex_lock(&sbi->wq_mutex); |
286 | for ( wql = &sbi->queues ; (wq = *wql) != 0 ; wql = &wq->next ) { | 286 | for ( wql = &sbi->queues ; (wq = *wql) != 0 ; wql = &wq->next ) { |
287 | if ( wq->wait_queue_token == wait_queue_token ) | 287 | if ( wq->wait_queue_token == wait_queue_token ) |
288 | break; | 288 | break; |
289 | } | 289 | } |
290 | 290 | ||
291 | if ( !wq ) { | 291 | if ( !wq ) { |
292 | up(&sbi->wq_sem); | 292 | mutex_unlock(&sbi->wq_mutex); |
293 | return -EINVAL; | 293 | return -EINVAL; |
294 | } | 294 | } |
295 | 295 | ||
296 | *wql = wq->next; /* Unlink from chain */ | 296 | *wql = wq->next; /* Unlink from chain */ |
297 | up(&sbi->wq_sem); | 297 | mutex_unlock(&sbi->wq_mutex); |
298 | kfree(wq->name); | 298 | kfree(wq->name); |
299 | wq->name = NULL; /* Do not wait on this queue */ | 299 | wq->name = NULL; /* Do not wait on this queue */ |
300 | 300 | ||