mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
[PATCH] sem2mutex: misc static one-file mutexes
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 <[email protected]> Cc: Dave Jones <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Neil Brown <[email protected]> Acked-by: Alasdair G Kergon <[email protected]> Cc: Greg KH <[email protected]> Cc: Dominik Brodowski <[email protected]> Cc: Adam Belay <[email protected]> Cc: Martin Schwidefsky <[email protected]> Cc: "David S. Miller" <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
353ab6e97b
commit
14cc3e2b63
20 changed files with 172 additions and 157 deletions
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include <linux/netfilter.h>
|
||||
#include <linux/netfilter_ipv4.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
#include <net/ip.h>
|
||||
#include <net/route.h>
|
||||
|
|
@ -44,7 +45,7 @@
|
|||
#include <net/ip_vs.h>
|
||||
|
||||
/* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */
|
||||
static DECLARE_MUTEX(__ip_vs_mutex);
|
||||
static DEFINE_MUTEX(__ip_vs_mutex);
|
||||
|
||||
/* lock for service table */
|
||||
static DEFINE_RWLOCK(__ip_vs_svc_lock);
|
||||
|
|
@ -1950,7 +1951,7 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
|
|||
/* increase the module use count */
|
||||
ip_vs_use_count_inc();
|
||||
|
||||
if (down_interruptible(&__ip_vs_mutex)) {
|
||||
if (mutex_lock_interruptible(&__ip_vs_mutex)) {
|
||||
ret = -ERESTARTSYS;
|
||||
goto out_dec;
|
||||
}
|
||||
|
|
@ -2041,7 +2042,7 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
|
|||
ip_vs_service_put(svc);
|
||||
|
||||
out_unlock:
|
||||
up(&__ip_vs_mutex);
|
||||
mutex_unlock(&__ip_vs_mutex);
|
||||
out_dec:
|
||||
/* decrease the module use count */
|
||||
ip_vs_use_count_dec();
|
||||
|
|
@ -2211,7 +2212,7 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
|
|||
if (copy_from_user(arg, user, get_arglen[GET_CMDID(cmd)]) != 0)
|
||||
return -EFAULT;
|
||||
|
||||
if (down_interruptible(&__ip_vs_mutex))
|
||||
if (mutex_lock_interruptible(&__ip_vs_mutex))
|
||||
return -ERESTARTSYS;
|
||||
|
||||
switch (cmd) {
|
||||
|
|
@ -2330,7 +2331,7 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
|
|||
}
|
||||
|
||||
out:
|
||||
up(&__ip_vs_mutex);
|
||||
mutex_unlock(&__ip_vs_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
/* FIXME: this is just for IP_NF_ASSERRT */
|
||||
#include <linux/netfilter_ipv4/ip_conntrack.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Harald Welte <[email protected]>");
|
||||
|
|
@ -92,7 +93,7 @@ struct ipt_hashlimit_htable {
|
|||
};
|
||||
|
||||
static DEFINE_SPINLOCK(hashlimit_lock); /* protects htables list */
|
||||
static DECLARE_MUTEX(hlimit_mutex); /* additional checkentry protection */
|
||||
static DEFINE_MUTEX(hlimit_mutex); /* additional checkentry protection */
|
||||
static HLIST_HEAD(hashlimit_htables);
|
||||
static kmem_cache_t *hashlimit_cachep __read_mostly;
|
||||
|
||||
|
|
@ -542,13 +543,13 @@ hashlimit_checkentry(const char *tablename,
|
|||
* call vmalloc, and that can sleep. And we cannot just re-search
|
||||
* the list of htable's in htable_create(), since then we would
|
||||
* create duplicate proc files. -HW */
|
||||
down(&hlimit_mutex);
|
||||
mutex_lock(&hlimit_mutex);
|
||||
r->hinfo = htable_find_get(r->name);
|
||||
if (!r->hinfo && (htable_create(r) != 0)) {
|
||||
up(&hlimit_mutex);
|
||||
mutex_unlock(&hlimit_mutex);
|
||||
return 0;
|
||||
}
|
||||
up(&hlimit_mutex);
|
||||
mutex_unlock(&hlimit_mutex);
|
||||
|
||||
/* Ugly hack: For SMP, we only want to use one set */
|
||||
r->u.master = r;
|
||||
|
|
|
|||
Loading…
Reference in a new issue