aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/callback.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/nfs/callback.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/nfs/callback.c')
-rw-r--r--fs/nfs/callback.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index 99d2cfbce863..90c95adc8c1b 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -14,6 +14,7 @@
14#include <linux/sunrpc/svc.h> 14#include <linux/sunrpc/svc.h>
15#include <linux/sunrpc/svcsock.h> 15#include <linux/sunrpc/svcsock.h>
16#include <linux/nfs_fs.h> 16#include <linux/nfs_fs.h>
17#include <linux/mutex.h>
17 18
18#include <net/inet_sock.h> 19#include <net/inet_sock.h>
19 20
@@ -31,7 +32,7 @@ struct nfs_callback_data {
31}; 32};
32 33
33static struct nfs_callback_data nfs_callback_info; 34static struct nfs_callback_data nfs_callback_info;
34static DECLARE_MUTEX(nfs_callback_sema); 35static DEFINE_MUTEX(nfs_callback_mutex);
35static struct svc_program nfs4_callback_program; 36static struct svc_program nfs4_callback_program;
36 37
37unsigned int nfs_callback_set_tcpport; 38unsigned int nfs_callback_set_tcpport;
@@ -95,7 +96,7 @@ int nfs_callback_up(void)
95 int ret = 0; 96 int ret = 0;
96 97
97 lock_kernel(); 98 lock_kernel();
98 down(&nfs_callback_sema); 99 mutex_lock(&nfs_callback_mutex);
99 if (nfs_callback_info.users++ || nfs_callback_info.pid != 0) 100 if (nfs_callback_info.users++ || nfs_callback_info.pid != 0)
100 goto out; 101 goto out;
101 init_completion(&nfs_callback_info.started); 102 init_completion(&nfs_callback_info.started);
@@ -121,7 +122,7 @@ int nfs_callback_up(void)
121 nfs_callback_info.serv = serv; 122 nfs_callback_info.serv = serv;
122 wait_for_completion(&nfs_callback_info.started); 123 wait_for_completion(&nfs_callback_info.started);
123out: 124out:
124 up(&nfs_callback_sema); 125 mutex_unlock(&nfs_callback_mutex);
125 unlock_kernel(); 126 unlock_kernel();
126 return ret; 127 return ret;
127out_destroy: 128out_destroy:
@@ -139,7 +140,7 @@ int nfs_callback_down(void)
139 int ret = 0; 140 int ret = 0;
140 141
141 lock_kernel(); 142 lock_kernel();
142 down(&nfs_callback_sema); 143 mutex_lock(&nfs_callback_mutex);
143 nfs_callback_info.users--; 144 nfs_callback_info.users--;
144 do { 145 do {
145 if (nfs_callback_info.users != 0 || nfs_callback_info.pid == 0) 146 if (nfs_callback_info.users != 0 || nfs_callback_info.pid == 0)
@@ -147,7 +148,7 @@ int nfs_callback_down(void)
147 if (kill_proc(nfs_callback_info.pid, SIGKILL, 1) < 0) 148 if (kill_proc(nfs_callback_info.pid, SIGKILL, 1) < 0)
148 break; 149 break;
149 } while (wait_for_completion_timeout(&nfs_callback_info.stopped, 5*HZ) == 0); 150 } while (wait_for_completion_timeout(&nfs_callback_info.stopped, 5*HZ) == 0);
150 up(&nfs_callback_sema); 151 mutex_unlock(&nfs_callback_mutex);
151 unlock_kernel(); 152 unlock_kernel();
152 return ret; 153 return ret;
153} 154}