aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/svclock.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-10-04 05:16:06 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-04 10:55:19 -0400
commit89e63ef609fb0064a47281e31e38010159c32d57 (patch)
treefcc1953b65d29caabbb4caf25498f4f160797a70 /fs/lockd/svclock.c
parentbc5fea4299b8bda5f73c6f79dc35d388caf8bced (diff)
[PATCH] Convert lockd to use the newer mutex instead of the older semaphore
Both the (recently introduces) nsm_sema and the older f_sema are converted over. Cc: Olaf Kirch <okir@suse.de> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/lockd/svclock.c')
-rw-r--r--fs/lockd/svclock.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 3d2b8a831be5..814c6064c9e0 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -254,9 +254,9 @@ static void nlmsvc_free_block(struct kref *kref)
254 dprintk("lockd: freeing block %p...\n", block); 254 dprintk("lockd: freeing block %p...\n", block);
255 255
256 /* Remove block from file's list of blocks */ 256 /* Remove block from file's list of blocks */
257 down(&file->f_sema); 257 mutex_lock(&file->f_mutex);
258 list_del_init(&block->b_flist); 258 list_del_init(&block->b_flist);
259 up(&file->f_sema); 259 mutex_unlock(&file->f_mutex);
260 260
261 nlmsvc_freegrantargs(block->b_call); 261 nlmsvc_freegrantargs(block->b_call);
262 nlm_release_call(block->b_call); 262 nlm_release_call(block->b_call);
@@ -281,7 +281,7 @@ void nlmsvc_traverse_blocks(struct nlm_host *host,
281 struct nlm_block *block, *next; 281 struct nlm_block *block, *next;
282 282
283restart: 283restart:
284 down(&file->f_sema); 284 mutex_lock(&file->f_mutex);
285 list_for_each_entry_safe(block, next, &file->f_blocks, b_flist) { 285 list_for_each_entry_safe(block, next, &file->f_blocks, b_flist) {
286 if (!match(block->b_host, host)) 286 if (!match(block->b_host, host))
287 continue; 287 continue;
@@ -290,12 +290,12 @@ restart:
290 if (list_empty(&block->b_list)) 290 if (list_empty(&block->b_list))
291 continue; 291 continue;
292 kref_get(&block->b_count); 292 kref_get(&block->b_count);
293 up(&file->f_sema); 293 mutex_unlock(&file->f_mutex);
294 nlmsvc_unlink_block(block); 294 nlmsvc_unlink_block(block);
295 nlmsvc_release_block(block); 295 nlmsvc_release_block(block);
296 goto restart; 296 goto restart;
297 } 297 }
298 up(&file->f_sema); 298 mutex_unlock(&file->f_mutex);
299} 299}
300 300
301/* 301/*
@@ -354,7 +354,7 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
354 lock->fl.fl_flags &= ~FL_SLEEP; 354 lock->fl.fl_flags &= ~FL_SLEEP;
355again: 355again:
356 /* Lock file against concurrent access */ 356 /* Lock file against concurrent access */
357 down(&file->f_sema); 357 mutex_lock(&file->f_mutex);
358 /* Get existing block (in case client is busy-waiting) */ 358 /* Get existing block (in case client is busy-waiting) */
359 block = nlmsvc_lookup_block(file, lock); 359 block = nlmsvc_lookup_block(file, lock);
360 if (block == NULL) { 360 if (block == NULL) {
@@ -392,10 +392,10 @@ again:
392 392
393 /* If we don't have a block, create and initialize it. Then 393 /* If we don't have a block, create and initialize it. Then
394 * retry because we may have slept in kmalloc. */ 394 * retry because we may have slept in kmalloc. */
395 /* We have to release f_sema as nlmsvc_create_block may try to 395 /* We have to release f_mutex as nlmsvc_create_block may try to
396 * to claim it while doing host garbage collection */ 396 * to claim it while doing host garbage collection */
397 if (newblock == NULL) { 397 if (newblock == NULL) {
398 up(&file->f_sema); 398 mutex_unlock(&file->f_mutex);
399 dprintk("lockd: blocking on this lock (allocating).\n"); 399 dprintk("lockd: blocking on this lock (allocating).\n");
400 if (!(newblock = nlmsvc_create_block(rqstp, file, lock, cookie))) 400 if (!(newblock = nlmsvc_create_block(rqstp, file, lock, cookie)))
401 return nlm_lck_denied_nolocks; 401 return nlm_lck_denied_nolocks;
@@ -405,7 +405,7 @@ again:
405 /* Append to list of blocked */ 405 /* Append to list of blocked */
406 nlmsvc_insert_block(newblock, NLM_NEVER); 406 nlmsvc_insert_block(newblock, NLM_NEVER);
407out: 407out:
408 up(&file->f_sema); 408 mutex_unlock(&file->f_mutex);
409 nlmsvc_release_block(newblock); 409 nlmsvc_release_block(newblock);
410 nlmsvc_release_block(block); 410 nlmsvc_release_block(block);
411 dprintk("lockd: nlmsvc_lock returned %u\n", ret); 411 dprintk("lockd: nlmsvc_lock returned %u\n", ret);
@@ -489,9 +489,9 @@ nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock)
489 (long long)lock->fl.fl_start, 489 (long long)lock->fl.fl_start,
490 (long long)lock->fl.fl_end); 490 (long long)lock->fl.fl_end);
491 491
492 down(&file->f_sema); 492 mutex_lock(&file->f_mutex);
493 block = nlmsvc_lookup_block(file, lock); 493 block = nlmsvc_lookup_block(file, lock);
494 up(&file->f_sema); 494 mutex_unlock(&file->f_mutex);
495 if (block != NULL) { 495 if (block != NULL) {
496 status = nlmsvc_unlink_block(block); 496 status = nlmsvc_unlink_block(block);
497 nlmsvc_release_block(block); 497 nlmsvc_release_block(block);