[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>
This commit is contained in:

committed by
Linus Torvalds

parent
e655a250d5
commit
353ab6e97b
@@ -14,6 +14,7 @@
|
||||
#include <linux/sunrpc/svc.h>
|
||||
#include <linux/sunrpc/svcsock.h>
|
||||
#include <linux/nfs_fs.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
#include <net/inet_sock.h>
|
||||
|
||||
@@ -31,7 +32,7 @@ struct nfs_callback_data {
|
||||
};
|
||||
|
||||
static struct nfs_callback_data nfs_callback_info;
|
||||
static DECLARE_MUTEX(nfs_callback_sema);
|
||||
static DEFINE_MUTEX(nfs_callback_mutex);
|
||||
static struct svc_program nfs4_callback_program;
|
||||
|
||||
unsigned int nfs_callback_set_tcpport;
|
||||
@@ -95,7 +96,7 @@ int nfs_callback_up(void)
|
||||
int ret = 0;
|
||||
|
||||
lock_kernel();
|
||||
down(&nfs_callback_sema);
|
||||
mutex_lock(&nfs_callback_mutex);
|
||||
if (nfs_callback_info.users++ || nfs_callback_info.pid != 0)
|
||||
goto out;
|
||||
init_completion(&nfs_callback_info.started);
|
||||
@@ -121,7 +122,7 @@ int nfs_callback_up(void)
|
||||
nfs_callback_info.serv = serv;
|
||||
wait_for_completion(&nfs_callback_info.started);
|
||||
out:
|
||||
up(&nfs_callback_sema);
|
||||
mutex_unlock(&nfs_callback_mutex);
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
out_destroy:
|
||||
@@ -139,7 +140,7 @@ int nfs_callback_down(void)
|
||||
int ret = 0;
|
||||
|
||||
lock_kernel();
|
||||
down(&nfs_callback_sema);
|
||||
mutex_lock(&nfs_callback_mutex);
|
||||
nfs_callback_info.users--;
|
||||
do {
|
||||
if (nfs_callback_info.users != 0 || nfs_callback_info.pid == 0)
|
||||
@@ -147,7 +148,7 @@ int nfs_callback_down(void)
|
||||
if (kill_proc(nfs_callback_info.pid, SIGKILL, 1) < 0)
|
||||
break;
|
||||
} while (wait_for_completion_timeout(&nfs_callback_info.stopped, 5*HZ) == 0);
|
||||
up(&nfs_callback_sema);
|
||||
mutex_unlock(&nfs_callback_mutex);
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user