diff options
Diffstat (limited to 'fs/lockd/svc.c')
-rw-r--r-- | fs/lockd/svc.c | 17 |
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; | |||
43 | struct nlmsvc_binding * nlmsvc_ops; | 44 | struct nlmsvc_binding * nlmsvc_ops; |
44 | EXPORT_SYMBOL(nlmsvc_ops); | 45 | EXPORT_SYMBOL(nlmsvc_ops); |
45 | 46 | ||
46 | static DECLARE_MUTEX(nlmsvc_sema); | 47 | static DEFINE_MUTEX(nlmsvc_mutex); |
47 | static unsigned int nlmsvc_users; | 48 | static unsigned int nlmsvc_users; |
48 | static pid_t nlmsvc_pid; | 49 | static pid_t nlmsvc_pid; |
49 | int nlmsvc_grace_period; | 50 | int nlmsvc_grace_period; |
50 | unsigned long nlmsvc_timeout; | 51 | unsigned long nlmsvc_timeout; |
51 | 52 | ||
52 | static DECLARE_MUTEX_LOCKED(lockd_start); | 53 | static DECLARE_COMPLETION(lockd_start_done); |
53 | static DECLARE_WAIT_QUEUE_HEAD(lockd_exit); | 54 | static 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) | |||
272 | destroy_and_out: | 273 | destroy_and_out: |
273 | svc_destroy(serv); | 274 | svc_destroy(serv); |
274 | out: | 275 | out: |
275 | up(&nlmsvc_sema); | 276 | mutex_unlock(&nlmsvc_mutex); |
276 | return error; | 277 | return error; |
277 | } | 278 | } |
278 | EXPORT_SYMBOL(lockd_up); | 279 | EXPORT_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(¤t->sighand->siglock); | 317 | spin_unlock_irq(¤t->sighand->siglock); |
317 | out: | 318 | out: |
318 | up(&nlmsvc_sema); | 319 | mutex_unlock(&nlmsvc_mutex); |
319 | } | 320 | } |
320 | EXPORT_SYMBOL(lockd_down); | 321 | EXPORT_SYMBOL(lockd_down); |
321 | 322 | ||