diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-26 04:37:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-26 11:56:55 -0500 |
commit | 14cc3e2b633bb64063698980974df4535368e98f (patch) | |
tree | d542c9db7376de199d640b8e34d5630460b217b5 /net | |
parent | 353ab6e97b8f209dbecc9f650f1f84e3da2a7bb1 (diff) |
[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 <mingo@elte.hu>
Cc: Dave Jones <davej@codemonkey.org.uk>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Jens Axboe <axboe@suse.de>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Acked-by: Alasdair G Kergon <agk@redhat.com>
Cc: Greg KH <greg@kroah.com>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/ipvs/ip_vs_ctl.c | 11 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_hashlimit.c | 9 | ||||
-rw-r--r-- | net/netlink/genetlink.c | 9 |
3 files changed, 16 insertions, 13 deletions
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c index 7f0288b25fa1..f28ec6882162 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/ipv4/ipvs/ip_vs_ctl.c | |||
@@ -34,6 +34,7 @@ | |||
34 | 34 | ||
35 | #include <linux/netfilter.h> | 35 | #include <linux/netfilter.h> |
36 | #include <linux/netfilter_ipv4.h> | 36 | #include <linux/netfilter_ipv4.h> |
37 | #include <linux/mutex.h> | ||
37 | 38 | ||
38 | #include <net/ip.h> | 39 | #include <net/ip.h> |
39 | #include <net/route.h> | 40 | #include <net/route.h> |
@@ -44,7 +45,7 @@ | |||
44 | #include <net/ip_vs.h> | 45 | #include <net/ip_vs.h> |
45 | 46 | ||
46 | /* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */ | 47 | /* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */ |
47 | static DECLARE_MUTEX(__ip_vs_mutex); | 48 | static DEFINE_MUTEX(__ip_vs_mutex); |
48 | 49 | ||
49 | /* lock for service table */ | 50 | /* lock for service table */ |
50 | static DEFINE_RWLOCK(__ip_vs_svc_lock); | 51 | 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) | |||
1950 | /* increase the module use count */ | 1951 | /* increase the module use count */ |
1951 | ip_vs_use_count_inc(); | 1952 | ip_vs_use_count_inc(); |
1952 | 1953 | ||
1953 | if (down_interruptible(&__ip_vs_mutex)) { | 1954 | if (mutex_lock_interruptible(&__ip_vs_mutex)) { |
1954 | ret = -ERESTARTSYS; | 1955 | ret = -ERESTARTSYS; |
1955 | goto out_dec; | 1956 | goto out_dec; |
1956 | } | 1957 | } |
@@ -2041,7 +2042,7 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) | |||
2041 | ip_vs_service_put(svc); | 2042 | ip_vs_service_put(svc); |
2042 | 2043 | ||
2043 | out_unlock: | 2044 | out_unlock: |
2044 | up(&__ip_vs_mutex); | 2045 | mutex_unlock(&__ip_vs_mutex); |
2045 | out_dec: | 2046 | out_dec: |
2046 | /* decrease the module use count */ | 2047 | /* decrease the module use count */ |
2047 | ip_vs_use_count_dec(); | 2048 | ip_vs_use_count_dec(); |
@@ -2211,7 +2212,7 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) | |||
2211 | if (copy_from_user(arg, user, get_arglen[GET_CMDID(cmd)]) != 0) | 2212 | if (copy_from_user(arg, user, get_arglen[GET_CMDID(cmd)]) != 0) |
2212 | return -EFAULT; | 2213 | return -EFAULT; |
2213 | 2214 | ||
2214 | if (down_interruptible(&__ip_vs_mutex)) | 2215 | if (mutex_lock_interruptible(&__ip_vs_mutex)) |
2215 | return -ERESTARTSYS; | 2216 | return -ERESTARTSYS; |
2216 | 2217 | ||
2217 | switch (cmd) { | 2218 | switch (cmd) { |
@@ -2330,7 +2331,7 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) | |||
2330 | } | 2331 | } |
2331 | 2332 | ||
2332 | out: | 2333 | out: |
2333 | up(&__ip_vs_mutex); | 2334 | mutex_unlock(&__ip_vs_mutex); |
2334 | return ret; | 2335 | return ret; |
2335 | } | 2336 | } |
2336 | 2337 | ||
diff --git a/net/ipv4/netfilter/ipt_hashlimit.c b/net/ipv4/netfilter/ipt_hashlimit.c index dc1521c5aa81..ba5e23505e88 100644 --- a/net/ipv4/netfilter/ipt_hashlimit.c +++ b/net/ipv4/netfilter/ipt_hashlimit.c | |||
@@ -40,6 +40,7 @@ | |||
40 | 40 | ||
41 | /* FIXME: this is just for IP_NF_ASSERRT */ | 41 | /* FIXME: this is just for IP_NF_ASSERRT */ |
42 | #include <linux/netfilter_ipv4/ip_conntrack.h> | 42 | #include <linux/netfilter_ipv4/ip_conntrack.h> |
43 | #include <linux/mutex.h> | ||
43 | 44 | ||
44 | MODULE_LICENSE("GPL"); | 45 | MODULE_LICENSE("GPL"); |
45 | MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); | 46 | MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); |
@@ -92,7 +93,7 @@ struct ipt_hashlimit_htable { | |||
92 | }; | 93 | }; |
93 | 94 | ||
94 | static DEFINE_SPINLOCK(hashlimit_lock); /* protects htables list */ | 95 | static DEFINE_SPINLOCK(hashlimit_lock); /* protects htables list */ |
95 | static DECLARE_MUTEX(hlimit_mutex); /* additional checkentry protection */ | 96 | static DEFINE_MUTEX(hlimit_mutex); /* additional checkentry protection */ |
96 | static HLIST_HEAD(hashlimit_htables); | 97 | static HLIST_HEAD(hashlimit_htables); |
97 | static kmem_cache_t *hashlimit_cachep __read_mostly; | 98 | static kmem_cache_t *hashlimit_cachep __read_mostly; |
98 | 99 | ||
@@ -542,13 +543,13 @@ hashlimit_checkentry(const char *tablename, | |||
542 | * call vmalloc, and that can sleep. And we cannot just re-search | 543 | * call vmalloc, and that can sleep. And we cannot just re-search |
543 | * the list of htable's in htable_create(), since then we would | 544 | * the list of htable's in htable_create(), since then we would |
544 | * create duplicate proc files. -HW */ | 545 | * create duplicate proc files. -HW */ |
545 | down(&hlimit_mutex); | 546 | mutex_lock(&hlimit_mutex); |
546 | r->hinfo = htable_find_get(r->name); | 547 | r->hinfo = htable_find_get(r->name); |
547 | if (!r->hinfo && (htable_create(r) != 0)) { | 548 | if (!r->hinfo && (htable_create(r) != 0)) { |
548 | up(&hlimit_mutex); | 549 | mutex_unlock(&hlimit_mutex); |
549 | return 0; | 550 | return 0; |
550 | } | 551 | } |
551 | up(&hlimit_mutex); | 552 | mutex_unlock(&hlimit_mutex); |
552 | 553 | ||
553 | /* Ugly hack: For SMP, we only want to use one set */ | 554 | /* Ugly hack: For SMP, we only want to use one set */ |
554 | r->u.master = r; | 555 | r->u.master = r; |
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 43e72419c868..f329b72578f5 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -13,26 +13,27 @@ | |||
13 | #include <linux/socket.h> | 13 | #include <linux/socket.h> |
14 | #include <linux/string.h> | 14 | #include <linux/string.h> |
15 | #include <linux/skbuff.h> | 15 | #include <linux/skbuff.h> |
16 | #include <linux/mutex.h> | ||
16 | #include <net/sock.h> | 17 | #include <net/sock.h> |
17 | #include <net/genetlink.h> | 18 | #include <net/genetlink.h> |
18 | 19 | ||
19 | struct sock *genl_sock = NULL; | 20 | struct sock *genl_sock = NULL; |
20 | 21 | ||
21 | static DECLARE_MUTEX(genl_sem); /* serialization of message processing */ | 22 | static DEFINE_MUTEX(genl_mutex); /* serialization of message processing */ |
22 | 23 | ||
23 | static void genl_lock(void) | 24 | static void genl_lock(void) |
24 | { | 25 | { |
25 | down(&genl_sem); | 26 | mutex_lock(&genl_mutex); |
26 | } | 27 | } |
27 | 28 | ||
28 | static int genl_trylock(void) | 29 | static int genl_trylock(void) |
29 | { | 30 | { |
30 | return down_trylock(&genl_sem); | 31 | return !mutex_trylock(&genl_mutex); |
31 | } | 32 | } |
32 | 33 | ||
33 | static void genl_unlock(void) | 34 | static void genl_unlock(void) |
34 | { | 35 | { |
35 | up(&genl_sem); | 36 | mutex_unlock(&genl_mutex); |
36 | 37 | ||
37 | if (genl_sock && genl_sock->sk_receive_queue.qlen) | 38 | if (genl_sock && genl_sock->sk_receive_queue.qlen) |
38 | genl_sock->sk_data_ready(genl_sock, 0); | 39 | genl_sock->sk_data_ready(genl_sock, 0); |