From 89e63ef609fb0064a47281e31e38010159c32d57 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Wed, 4 Oct 2006 02:16:06 -0700 Subject: [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 Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/lockd/host.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'fs/lockd/host.c') 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) * Manage NSM handles */ static LIST_HEAD(nsm_handles); -static DECLARE_MUTEX(nsm_sema); +static DEFINE_MUTEX(nsm_mutex); static struct nsm_handle * __nsm_find(const struct sockaddr_in *sin, @@ -458,7 +458,7 @@ __nsm_find(const struct sockaddr_in *sin, return NULL; } - down(&nsm_sema); + mutex_lock(&nsm_mutex); list_for_each(pos, &nsm_handles) { nsm = list_entry(pos, struct nsm_handle, sm_link); @@ -488,7 +488,8 @@ __nsm_find(const struct sockaddr_in *sin, list_add(&nsm->sm_link, &nsm_handles); } -out: up(&nsm_sema); +out: + mutex_unlock(&nsm_mutex); return nsm; } @@ -507,11 +508,11 @@ nsm_release(struct nsm_handle *nsm) if (!nsm) return; if (atomic_dec_and_test(&nsm->sm_count)) { - down(&nsm_sema); + mutex_lock(&nsm_mutex); if (atomic_read(&nsm->sm_count) == 0) { list_del(&nsm->sm_link); kfree(nsm); } - up(&nsm_sema); + mutex_unlock(&nsm_mutex); } } -- cgit v1.2.3