aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4
diff options
context:
space:
mode:
Diffstat (limited to 'fs/autofs4')
-rw-r--r--fs/autofs4/autofs_i.h3
-rw-r--r--fs/autofs4/inode.c2
-rw-r--r--fs/autofs4/waitq.c16
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