diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-20 13:44:11 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-20 13:44:11 -0500 |
commit | c9d5128a10a4974f72674ff3463da4db439e8b04 (patch) | |
tree | 304b277f5388e8285f56535db654051d0f4a2fc0 | |
parent | bd6475454c774bd9dbe6078d94bbf72b1d3b65f4 (diff) |
NFS: sem2mutex idmap.c
semaphore to mutex conversion.
the conversion was generated via scripts, and the result was validated
automatically via a script as well.
build and boot tested.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/idmap.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index b89d27f93d66..3fab5b0cfc5a 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c | |||
@@ -35,6 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include <linux/module.h> | 37 | #include <linux/module.h> |
38 | #include <linux/mutex.h> | ||
38 | #include <linux/init.h> | 39 | #include <linux/init.h> |
39 | #include <linux/types.h> | 40 | #include <linux/types.h> |
40 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
@@ -74,8 +75,8 @@ struct idmap { | |||
74 | struct dentry *idmap_dentry; | 75 | struct dentry *idmap_dentry; |
75 | wait_queue_head_t idmap_wq; | 76 | wait_queue_head_t idmap_wq; |
76 | struct idmap_msg idmap_im; | 77 | struct idmap_msg idmap_im; |
77 | struct semaphore idmap_lock; /* Serializes upcalls */ | 78 | struct mutex idmap_lock; /* Serializes upcalls */ |
78 | struct semaphore idmap_im_lock; /* Protects the hashtable */ | 79 | struct mutex idmap_im_lock; /* Protects the hashtable */ |
79 | struct idmap_hashtable idmap_user_hash; | 80 | struct idmap_hashtable idmap_user_hash; |
80 | struct idmap_hashtable idmap_group_hash; | 81 | struct idmap_hashtable idmap_group_hash; |
81 | }; | 82 | }; |
@@ -114,8 +115,8 @@ nfs_idmap_new(struct nfs4_client *clp) | |||
114 | return; | 115 | return; |
115 | } | 116 | } |
116 | 117 | ||
117 | init_MUTEX(&idmap->idmap_lock); | 118 | mutex_init(&idmap->idmap_lock); |
118 | init_MUTEX(&idmap->idmap_im_lock); | 119 | mutex_init(&idmap->idmap_im_lock); |
119 | init_waitqueue_head(&idmap->idmap_wq); | 120 | init_waitqueue_head(&idmap->idmap_wq); |
120 | idmap->idmap_user_hash.h_type = IDMAP_TYPE_USER; | 121 | idmap->idmap_user_hash.h_type = IDMAP_TYPE_USER; |
121 | idmap->idmap_group_hash.h_type = IDMAP_TYPE_GROUP; | 122 | idmap->idmap_group_hash.h_type = IDMAP_TYPE_GROUP; |
@@ -232,8 +233,8 @@ nfs_idmap_id(struct idmap *idmap, struct idmap_hashtable *h, | |||
232 | if (namelen >= IDMAP_NAMESZ) | 233 | if (namelen >= IDMAP_NAMESZ) |
233 | return -EINVAL; | 234 | return -EINVAL; |
234 | 235 | ||
235 | down(&idmap->idmap_lock); | 236 | mutex_lock(&idmap->idmap_lock); |
236 | down(&idmap->idmap_im_lock); | 237 | mutex_lock(&idmap->idmap_im_lock); |
237 | 238 | ||
238 | he = idmap_lookup_name(h, name, namelen); | 239 | he = idmap_lookup_name(h, name, namelen); |
239 | if (he != NULL) { | 240 | if (he != NULL) { |
@@ -259,11 +260,11 @@ nfs_idmap_id(struct idmap *idmap, struct idmap_hashtable *h, | |||
259 | } | 260 | } |
260 | 261 | ||
261 | set_current_state(TASK_UNINTERRUPTIBLE); | 262 | set_current_state(TASK_UNINTERRUPTIBLE); |
262 | up(&idmap->idmap_im_lock); | 263 | mutex_unlock(&idmap->idmap_im_lock); |
263 | schedule(); | 264 | schedule(); |
264 | current->state = TASK_RUNNING; | 265 | current->state = TASK_RUNNING; |
265 | remove_wait_queue(&idmap->idmap_wq, &wq); | 266 | remove_wait_queue(&idmap->idmap_wq, &wq); |
266 | down(&idmap->idmap_im_lock); | 267 | mutex_lock(&idmap->idmap_im_lock); |
267 | 268 | ||
268 | if (im->im_status & IDMAP_STATUS_SUCCESS) { | 269 | if (im->im_status & IDMAP_STATUS_SUCCESS) { |
269 | *id = im->im_id; | 270 | *id = im->im_id; |
@@ -272,8 +273,8 @@ nfs_idmap_id(struct idmap *idmap, struct idmap_hashtable *h, | |||
272 | 273 | ||
273 | out: | 274 | out: |
274 | memset(im, 0, sizeof(*im)); | 275 | memset(im, 0, sizeof(*im)); |
275 | up(&idmap->idmap_im_lock); | 276 | mutex_unlock(&idmap->idmap_im_lock); |
276 | up(&idmap->idmap_lock); | 277 | mutex_unlock(&idmap->idmap_lock); |
277 | return (ret); | 278 | return (ret); |
278 | } | 279 | } |
279 | 280 | ||
@@ -293,8 +294,8 @@ nfs_idmap_name(struct idmap *idmap, struct idmap_hashtable *h, | |||
293 | 294 | ||
294 | im = &idmap->idmap_im; | 295 | im = &idmap->idmap_im; |
295 | 296 | ||
296 | down(&idmap->idmap_lock); | 297 | mutex_lock(&idmap->idmap_lock); |
297 | down(&idmap->idmap_im_lock); | 298 | mutex_lock(&idmap->idmap_im_lock); |
298 | 299 | ||
299 | he = idmap_lookup_id(h, id); | 300 | he = idmap_lookup_id(h, id); |
300 | if (he != 0) { | 301 | if (he != 0) { |
@@ -320,11 +321,11 @@ nfs_idmap_name(struct idmap *idmap, struct idmap_hashtable *h, | |||
320 | } | 321 | } |
321 | 322 | ||
322 | set_current_state(TASK_UNINTERRUPTIBLE); | 323 | set_current_state(TASK_UNINTERRUPTIBLE); |
323 | up(&idmap->idmap_im_lock); | 324 | mutex_unlock(&idmap->idmap_im_lock); |
324 | schedule(); | 325 | schedule(); |
325 | current->state = TASK_RUNNING; | 326 | current->state = TASK_RUNNING; |
326 | remove_wait_queue(&idmap->idmap_wq, &wq); | 327 | remove_wait_queue(&idmap->idmap_wq, &wq); |
327 | down(&idmap->idmap_im_lock); | 328 | mutex_lock(&idmap->idmap_im_lock); |
328 | 329 | ||
329 | if (im->im_status & IDMAP_STATUS_SUCCESS) { | 330 | if (im->im_status & IDMAP_STATUS_SUCCESS) { |
330 | if ((len = strnlen(im->im_name, IDMAP_NAMESZ)) == 0) | 331 | if ((len = strnlen(im->im_name, IDMAP_NAMESZ)) == 0) |
@@ -335,8 +336,8 @@ nfs_idmap_name(struct idmap *idmap, struct idmap_hashtable *h, | |||
335 | 336 | ||
336 | out: | 337 | out: |
337 | memset(im, 0, sizeof(*im)); | 338 | memset(im, 0, sizeof(*im)); |
338 | up(&idmap->idmap_im_lock); | 339 | mutex_unlock(&idmap->idmap_im_lock); |
339 | up(&idmap->idmap_lock); | 340 | mutex_unlock(&idmap->idmap_lock); |
340 | return ret; | 341 | return ret; |
341 | } | 342 | } |
342 | 343 | ||
@@ -380,7 +381,7 @@ idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) | |||
380 | if (copy_from_user(&im_in, src, mlen) != 0) | 381 | if (copy_from_user(&im_in, src, mlen) != 0) |
381 | return (-EFAULT); | 382 | return (-EFAULT); |
382 | 383 | ||
383 | down(&idmap->idmap_im_lock); | 384 | mutex_lock(&idmap->idmap_im_lock); |
384 | 385 | ||
385 | ret = mlen; | 386 | ret = mlen; |
386 | im->im_status = im_in.im_status; | 387 | im->im_status = im_in.im_status; |
@@ -440,7 +441,7 @@ idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) | |||
440 | idmap_update_entry(he, im_in.im_name, namelen_in, im_in.im_id); | 441 | idmap_update_entry(he, im_in.im_name, namelen_in, im_in.im_id); |
441 | ret = mlen; | 442 | ret = mlen; |
442 | out: | 443 | out: |
443 | up(&idmap->idmap_im_lock); | 444 | mutex_unlock(&idmap->idmap_im_lock); |
444 | return ret; | 445 | return ret; |
445 | } | 446 | } |
446 | 447 | ||
@@ -452,10 +453,10 @@ idmap_pipe_destroy_msg(struct rpc_pipe_msg *msg) | |||
452 | 453 | ||
453 | if (msg->errno >= 0) | 454 | if (msg->errno >= 0) |
454 | return; | 455 | return; |
455 | down(&idmap->idmap_im_lock); | 456 | mutex_lock(&idmap->idmap_im_lock); |
456 | im->im_status = IDMAP_STATUS_LOOKUPFAIL; | 457 | im->im_status = IDMAP_STATUS_LOOKUPFAIL; |
457 | wake_up(&idmap->idmap_wq); | 458 | wake_up(&idmap->idmap_wq); |
458 | up(&idmap->idmap_im_lock); | 459 | mutex_unlock(&idmap->idmap_im_lock); |
459 | } | 460 | } |
460 | 461 | ||
461 | /* | 462 | /* |