aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/sched.c')
-rw-r--r--net/sunrpc/sched.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index e838d042f7f5..dff07795bd16 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -18,6 +18,7 @@
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/smp_lock.h> 19#include <linux/smp_lock.h>
20#include <linux/spinlock.h> 20#include <linux/spinlock.h>
21#include <linux/mutex.h>
21 22
22#include <linux/sunrpc/clnt.h> 23#include <linux/sunrpc/clnt.h>
23#include <linux/sunrpc/xprt.h> 24#include <linux/sunrpc/xprt.h>
@@ -62,7 +63,7 @@ static LIST_HEAD(all_tasks);
62/* 63/*
63 * rpciod-related stuff 64 * rpciod-related stuff
64 */ 65 */
65static DECLARE_MUTEX(rpciod_sema); 66static DEFINE_MUTEX(rpciod_mutex);
66static unsigned int rpciod_users; 67static unsigned int rpciod_users;
67static struct workqueue_struct *rpciod_workqueue; 68static struct workqueue_struct *rpciod_workqueue;
68 69
@@ -1047,7 +1048,7 @@ rpciod_up(void)
1047 struct workqueue_struct *wq; 1048 struct workqueue_struct *wq;
1048 int error = 0; 1049 int error = 0;
1049 1050
1050 down(&rpciod_sema); 1051 mutex_lock(&rpciod_mutex);
1051 dprintk("rpciod_up: users %d\n", rpciod_users); 1052 dprintk("rpciod_up: users %d\n", rpciod_users);
1052 rpciod_users++; 1053 rpciod_users++;
1053 if (rpciod_workqueue) 1054 if (rpciod_workqueue)
@@ -1070,14 +1071,14 @@ rpciod_up(void)
1070 rpciod_workqueue = wq; 1071 rpciod_workqueue = wq;
1071 error = 0; 1072 error = 0;
1072out: 1073out:
1073 up(&rpciod_sema); 1074 mutex_unlock(&rpciod_mutex);
1074 return error; 1075 return error;
1075} 1076}
1076 1077
1077void 1078void
1078rpciod_down(void) 1079rpciod_down(void)
1079{ 1080{
1080 down(&rpciod_sema); 1081 mutex_lock(&rpciod_mutex);
1081 dprintk("rpciod_down sema %d\n", rpciod_users); 1082 dprintk("rpciod_down sema %d\n", rpciod_users);
1082 if (rpciod_users) { 1083 if (rpciod_users) {
1083 if (--rpciod_users) 1084 if (--rpciod_users)
@@ -1094,7 +1095,7 @@ rpciod_down(void)
1094 destroy_workqueue(rpciod_workqueue); 1095 destroy_workqueue(rpciod_workqueue);
1095 rpciod_workqueue = NULL; 1096 rpciod_workqueue = NULL;
1096 out: 1097 out:
1097 up(&rpciod_sema); 1098 mutex_unlock(&rpciod_mutex);
1098} 1099}
1099 1100
1100#ifdef RPC_DEBUG 1101#ifdef RPC_DEBUG