aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/svc.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-03-26 04:37:12 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-26 11:56:55 -0500
commit353ab6e97b8f209dbecc9f650f1f84e3da2a7bb1 (patch)
treebffabd9a5a493ffd2b41dd825e71e848ca6ba6d7 /fs/lockd/svc.c
parente655a250d5fc12b6dfe0d436180ba4a3bfffdc9f (diff)
[PATCH] sem2mutex: fs/
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: Eric Van Hensbergen <ericvh@ericvh.myip.org> Cc: Robert Love <rml@tech9.net> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Neil Brown <neilb@cse.unsw.edu.au> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Cc: Dave Kleikamp <shaggy@austin.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/lockd/svc.c')
-rw-r--r--fs/lockd/svc.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 5e85bde6c123..fd56c8872f34 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -25,6 +25,7 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/smp.h> 26#include <linux/smp.h>
27#include <linux/smp_lock.h> 27#include <linux/smp_lock.h>
28#include <linux/mutex.h>
28 29
29#include <linux/sunrpc/types.h> 30#include <linux/sunrpc/types.h>
30#include <linux/sunrpc/stats.h> 31#include <linux/sunrpc/stats.h>
@@ -43,13 +44,13 @@ static struct svc_program nlmsvc_program;
43struct nlmsvc_binding * nlmsvc_ops; 44struct nlmsvc_binding * nlmsvc_ops;
44EXPORT_SYMBOL(nlmsvc_ops); 45EXPORT_SYMBOL(nlmsvc_ops);
45 46
46static DECLARE_MUTEX(nlmsvc_sema); 47static DEFINE_MUTEX(nlmsvc_mutex);
47static unsigned int nlmsvc_users; 48static unsigned int nlmsvc_users;
48static pid_t nlmsvc_pid; 49static pid_t nlmsvc_pid;
49int nlmsvc_grace_period; 50int nlmsvc_grace_period;
50unsigned long nlmsvc_timeout; 51unsigned long nlmsvc_timeout;
51 52
52static DECLARE_MUTEX_LOCKED(lockd_start); 53static DECLARE_COMPLETION(lockd_start_done);
53static DECLARE_WAIT_QUEUE_HEAD(lockd_exit); 54static DECLARE_WAIT_QUEUE_HEAD(lockd_exit);
54 55
55/* 56/*
@@ -112,7 +113,7 @@ lockd(struct svc_rqst *rqstp)
112 * Let our maker know we're running. 113 * Let our maker know we're running.
113 */ 114 */
114 nlmsvc_pid = current->pid; 115 nlmsvc_pid = current->pid;
115 up(&lockd_start); 116 complete(&lockd_start_done);
116 117
117 daemonize("lockd"); 118 daemonize("lockd");
118 119
@@ -215,7 +216,7 @@ lockd_up(void)
215 struct svc_serv * serv; 216 struct svc_serv * serv;
216 int error = 0; 217 int error = 0;
217 218
218 down(&nlmsvc_sema); 219 mutex_lock(&nlmsvc_mutex);
219 /* 220 /*
220 * Unconditionally increment the user count ... this is 221 * Unconditionally increment the user count ... this is
221 * the number of clients who _want_ a lockd process. 222 * the number of clients who _want_ a lockd process.
@@ -263,7 +264,7 @@ lockd_up(void)
263 "lockd_up: create thread failed, error=%d\n", error); 264 "lockd_up: create thread failed, error=%d\n", error);
264 goto destroy_and_out; 265 goto destroy_and_out;
265 } 266 }
266 down(&lockd_start); 267 wait_for_completion(&lockd_start_done);
267 268
268 /* 269 /*
269 * Note: svc_serv structures have an initial use count of 1, 270 * Note: svc_serv structures have an initial use count of 1,
@@ -272,7 +273,7 @@ lockd_up(void)
272destroy_and_out: 273destroy_and_out:
273 svc_destroy(serv); 274 svc_destroy(serv);
274out: 275out:
275 up(&nlmsvc_sema); 276 mutex_unlock(&nlmsvc_mutex);
276 return error; 277 return error;
277} 278}
278EXPORT_SYMBOL(lockd_up); 279EXPORT_SYMBOL(lockd_up);
@@ -285,7 +286,7 @@ lockd_down(void)
285{ 286{
286 static int warned; 287 static int warned;
287 288
288 down(&nlmsvc_sema); 289 mutex_lock(&nlmsvc_mutex);
289 if (nlmsvc_users) { 290 if (nlmsvc_users) {
290 if (--nlmsvc_users) 291 if (--nlmsvc_users)
291 goto out; 292 goto out;
@@ -315,7 +316,7 @@ lockd_down(void)
315 recalc_sigpending(); 316 recalc_sigpending();
316 spin_unlock_irq(&current->sighand->siglock); 317 spin_unlock_irq(&current->sighand->siglock);
317out: 318out:
318 up(&nlmsvc_sema); 319 mutex_unlock(&nlmsvc_mutex);
319} 320}
320EXPORT_SYMBOL(lockd_down); 321EXPORT_SYMBOL(lockd_down);
321 322