aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/host.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/lockd/host.c')
-rw-r--r--fs/lockd/host.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index a1423c66df04..0257a5594524 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -436,7 +436,7 @@ nlm_gc_hosts(void)
436 * Manage NSM handles 436 * Manage NSM handles
437 */ 437 */
438static LIST_HEAD(nsm_handles); 438static LIST_HEAD(nsm_handles);
439static DECLARE_MUTEX(nsm_sema); 439static DEFINE_MUTEX(nsm_mutex);
440 440
441static struct nsm_handle * 441static struct nsm_handle *
442__nsm_find(const struct sockaddr_in *sin, 442__nsm_find(const struct sockaddr_in *sin,
@@ -458,7 +458,7 @@ __nsm_find(const struct sockaddr_in *sin,
458 return NULL; 458 return NULL;
459 } 459 }
460 460
461 down(&nsm_sema); 461 mutex_lock(&nsm_mutex);
462 list_for_each(pos, &nsm_handles) { 462 list_for_each(pos, &nsm_handles) {
463 nsm = list_entry(pos, struct nsm_handle, sm_link); 463 nsm = list_entry(pos, struct nsm_handle, sm_link);
464 464
@@ -488,7 +488,8 @@ __nsm_find(const struct sockaddr_in *sin,
488 list_add(&nsm->sm_link, &nsm_handles); 488 list_add(&nsm->sm_link, &nsm_handles);
489 } 489 }
490 490
491out: up(&nsm_sema); 491out:
492 mutex_unlock(&nsm_mutex);
492 return nsm; 493 return nsm;
493} 494}
494 495
@@ -507,11 +508,11 @@ nsm_release(struct nsm_handle *nsm)
507 if (!nsm) 508 if (!nsm)
508 return; 509 return;
509 if (atomic_dec_and_test(&nsm->sm_count)) { 510 if (atomic_dec_and_test(&nsm->sm_count)) {
510 down(&nsm_sema); 511 mutex_lock(&nsm_mutex);
511 if (atomic_read(&nsm->sm_count) == 0) { 512 if (atomic_read(&nsm->sm_count) == 0) {
512 list_del(&nsm->sm_link); 513 list_del(&nsm->sm_link);
513 kfree(nsm); 514 kfree(nsm);
514 } 515 }
515 up(&nsm_sema); 516 mutex_unlock(&nsm_mutex);
516 } 517 }
517} 518}