aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/host.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-10-04 02:16:06 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-04 07:55:19 -0700
commit89e63ef609fb0064a47281e31e38010159c32d57 (patch)
treefcc1953b65d29caabbb4caf25498f4f160797a70 /fs/lockd/host.c
parent[PATCH] knfsd: register all RPC programs with portmapper by default (diff)
downloadlinux-dev-89e63ef609fb0064a47281e31e38010159c32d57.tar.xz
linux-dev-89e63ef609fb0064a47281e31e38010159c32d57.zip
[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/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)
* 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);
}
}