diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-21 01:35:41 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-21 01:35:41 -0500 |
commit | 57b47a53ec4a67691ba32cff5768e8d78fa6c67f (patch) | |
tree | d735ae4734f7b386eefa508a0629715f45808d1d | |
parent | 6613f82dd293b23f582a649b287fadbf8d23e6cf (diff) |
[NET]: sem2mutex part 2
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>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/sunrpc/svcsock.h | 2 | ||||
-rw-r--r-- | include/net/af_unix.h | 3 | ||||
-rw-r--r-- | net/atm/common.c | 4 | ||||
-rw-r--r-- | net/atm/resources.c | 32 | ||||
-rw-r--r-- | net/atm/resources.h | 3 | ||||
-rw-r--r-- | net/bridge/netfilter/ebtables.c | 91 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_app.c | 19 | ||||
-rw-r--r-- | net/ipv4/netfilter/arp_tables.c | 2 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_tables.c | 2 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6_tables.c | 2 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_core.c | 16 | ||||
-rw-r--r-- | net/sunrpc/svcsock.c | 8 | ||||
-rw-r--r-- | net/unix/af_unix.c | 22 |
13 files changed, 107 insertions, 99 deletions
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h index d33c6face032..b4acb3d37c3f 100644 --- a/include/linux/sunrpc/svcsock.h +++ b/include/linux/sunrpc/svcsock.h | |||
@@ -36,7 +36,7 @@ struct svc_sock { | |||
36 | 36 | ||
37 | struct list_head sk_deferred; /* deferred requests that need to | 37 | struct list_head sk_deferred; /* deferred requests that need to |
38 | * be revisted */ | 38 | * be revisted */ |
39 | struct semaphore sk_sem; /* to serialize sending data */ | 39 | struct mutex sk_mutex; /* to serialize sending data */ |
40 | 40 | ||
41 | int (*sk_recvfrom)(struct svc_rqst *rqstp); | 41 | int (*sk_recvfrom)(struct svc_rqst *rqstp); |
42 | int (*sk_sendto)(struct svc_rqst *rqstp); | 42 | int (*sk_sendto)(struct svc_rqst *rqstp); |
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index bfc1779fc753..427dac94bc7e 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/config.h> | 4 | #include <linux/config.h> |
5 | #include <linux/socket.h> | 5 | #include <linux/socket.h> |
6 | #include <linux/un.h> | 6 | #include <linux/un.h> |
7 | #include <linux/mutex.h> | ||
7 | #include <net/sock.h> | 8 | #include <net/sock.h> |
8 | 9 | ||
9 | extern void unix_inflight(struct file *fp); | 10 | extern void unix_inflight(struct file *fp); |
@@ -71,7 +72,7 @@ struct unix_sock { | |||
71 | struct unix_address *addr; | 72 | struct unix_address *addr; |
72 | struct dentry *dentry; | 73 | struct dentry *dentry; |
73 | struct vfsmount *mnt; | 74 | struct vfsmount *mnt; |
74 | struct semaphore readsem; | 75 | struct mutex readlock; |
75 | struct sock *peer; | 76 | struct sock *peer; |
76 | struct sock *other; | 77 | struct sock *other; |
77 | struct sock *gc_tree; | 78 | struct sock *gc_tree; |
diff --git a/net/atm/common.c b/net/atm/common.c index 6656b111cc05..ae002220fa99 100644 --- a/net/atm/common.c +++ b/net/atm/common.c | |||
@@ -451,12 +451,12 @@ int vcc_connect(struct socket *sock, int itf, short vpi, int vci) | |||
451 | dev = try_then_request_module(atm_dev_lookup(itf), "atm-device-%d", itf); | 451 | dev = try_then_request_module(atm_dev_lookup(itf), "atm-device-%d", itf); |
452 | } else { | 452 | } else { |
453 | dev = NULL; | 453 | dev = NULL; |
454 | down(&atm_dev_mutex); | 454 | mutex_lock(&atm_dev_mutex); |
455 | if (!list_empty(&atm_devs)) { | 455 | if (!list_empty(&atm_devs)) { |
456 | dev = list_entry(atm_devs.next, struct atm_dev, dev_list); | 456 | dev = list_entry(atm_devs.next, struct atm_dev, dev_list); |
457 | atm_dev_hold(dev); | 457 | atm_dev_hold(dev); |
458 | } | 458 | } |
459 | up(&atm_dev_mutex); | 459 | mutex_unlock(&atm_dev_mutex); |
460 | } | 460 | } |
461 | if (!dev) | 461 | if (!dev) |
462 | return -ENODEV; | 462 | return -ENODEV; |
diff --git a/net/atm/resources.c b/net/atm/resources.c index 224190537c90..18ac80698f83 100644 --- a/net/atm/resources.c +++ b/net/atm/resources.c | |||
@@ -18,6 +18,8 @@ | |||
18 | #include <linux/bitops.h> | 18 | #include <linux/bitops.h> |
19 | #include <linux/capability.h> | 19 | #include <linux/capability.h> |
20 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
21 | #include <linux/mutex.h> | ||
22 | |||
21 | #include <net/sock.h> /* for struct sock */ | 23 | #include <net/sock.h> /* for struct sock */ |
22 | 24 | ||
23 | #include "common.h" | 25 | #include "common.h" |
@@ -26,7 +28,7 @@ | |||
26 | 28 | ||
27 | 29 | ||
28 | LIST_HEAD(atm_devs); | 30 | LIST_HEAD(atm_devs); |
29 | DECLARE_MUTEX(atm_dev_mutex); | 31 | DEFINE_MUTEX(atm_dev_mutex); |
30 | 32 | ||
31 | static struct atm_dev *__alloc_atm_dev(const char *type) | 33 | static struct atm_dev *__alloc_atm_dev(const char *type) |
32 | { | 34 | { |
@@ -65,9 +67,9 @@ struct atm_dev *atm_dev_lookup(int number) | |||
65 | { | 67 | { |
66 | struct atm_dev *dev; | 68 | struct atm_dev *dev; |
67 | 69 | ||
68 | down(&atm_dev_mutex); | 70 | mutex_lock(&atm_dev_mutex); |
69 | dev = __atm_dev_lookup(number); | 71 | dev = __atm_dev_lookup(number); |
70 | up(&atm_dev_mutex); | 72 | mutex_unlock(&atm_dev_mutex); |
71 | return dev; | 73 | return dev; |
72 | } | 74 | } |
73 | 75 | ||
@@ -83,11 +85,11 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, | |||
83 | type); | 85 | type); |
84 | return NULL; | 86 | return NULL; |
85 | } | 87 | } |
86 | down(&atm_dev_mutex); | 88 | mutex_lock(&atm_dev_mutex); |
87 | if (number != -1) { | 89 | if (number != -1) { |
88 | if ((inuse = __atm_dev_lookup(number))) { | 90 | if ((inuse = __atm_dev_lookup(number))) { |
89 | atm_dev_put(inuse); | 91 | atm_dev_put(inuse); |
90 | up(&atm_dev_mutex); | 92 | mutex_unlock(&atm_dev_mutex); |
91 | kfree(dev); | 93 | kfree(dev); |
92 | return NULL; | 94 | return NULL; |
93 | } | 95 | } |
@@ -112,12 +114,12 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, | |||
112 | printk(KERN_ERR "atm_dev_register: " | 114 | printk(KERN_ERR "atm_dev_register: " |
113 | "atm_proc_dev_register failed for dev %s\n", | 115 | "atm_proc_dev_register failed for dev %s\n", |
114 | type); | 116 | type); |
115 | up(&atm_dev_mutex); | 117 | mutex_unlock(&atm_dev_mutex); |
116 | kfree(dev); | 118 | kfree(dev); |
117 | return NULL; | 119 | return NULL; |
118 | } | 120 | } |
119 | list_add_tail(&dev->dev_list, &atm_devs); | 121 | list_add_tail(&dev->dev_list, &atm_devs); |
120 | up(&atm_dev_mutex); | 122 | mutex_unlock(&atm_dev_mutex); |
121 | 123 | ||
122 | return dev; | 124 | return dev; |
123 | } | 125 | } |
@@ -133,9 +135,9 @@ void atm_dev_deregister(struct atm_dev *dev) | |||
133 | * with same number can appear, such we need deregister proc, | 135 | * with same number can appear, such we need deregister proc, |
134 | * release async all vccs and remove them from vccs list too | 136 | * release async all vccs and remove them from vccs list too |
135 | */ | 137 | */ |
136 | down(&atm_dev_mutex); | 138 | mutex_lock(&atm_dev_mutex); |
137 | list_del(&dev->dev_list); | 139 | list_del(&dev->dev_list); |
138 | up(&atm_dev_mutex); | 140 | mutex_unlock(&atm_dev_mutex); |
139 | 141 | ||
140 | atm_dev_release_vccs(dev); | 142 | atm_dev_release_vccs(dev); |
141 | atm_proc_dev_deregister(dev); | 143 | atm_proc_dev_deregister(dev); |
@@ -196,16 +198,16 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg) | |||
196 | return -EFAULT; | 198 | return -EFAULT; |
197 | if (get_user(len, &iobuf->length)) | 199 | if (get_user(len, &iobuf->length)) |
198 | return -EFAULT; | 200 | return -EFAULT; |
199 | down(&atm_dev_mutex); | 201 | mutex_lock(&atm_dev_mutex); |
200 | list_for_each(p, &atm_devs) | 202 | list_for_each(p, &atm_devs) |
201 | size += sizeof(int); | 203 | size += sizeof(int); |
202 | if (size > len) { | 204 | if (size > len) { |
203 | up(&atm_dev_mutex); | 205 | mutex_unlock(&atm_dev_mutex); |
204 | return -E2BIG; | 206 | return -E2BIG; |
205 | } | 207 | } |
206 | tmp_buf = kmalloc(size, GFP_ATOMIC); | 208 | tmp_buf = kmalloc(size, GFP_ATOMIC); |
207 | if (!tmp_buf) { | 209 | if (!tmp_buf) { |
208 | up(&atm_dev_mutex); | 210 | mutex_unlock(&atm_dev_mutex); |
209 | return -ENOMEM; | 211 | return -ENOMEM; |
210 | } | 212 | } |
211 | tmp_p = tmp_buf; | 213 | tmp_p = tmp_buf; |
@@ -213,7 +215,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg) | |||
213 | dev = list_entry(p, struct atm_dev, dev_list); | 215 | dev = list_entry(p, struct atm_dev, dev_list); |
214 | *tmp_p++ = dev->number; | 216 | *tmp_p++ = dev->number; |
215 | } | 217 | } |
216 | up(&atm_dev_mutex); | 218 | mutex_unlock(&atm_dev_mutex); |
217 | error = ((copy_to_user(buf, tmp_buf, size)) || | 219 | error = ((copy_to_user(buf, tmp_buf, size)) || |
218 | put_user(size, &iobuf->length)) | 220 | put_user(size, &iobuf->length)) |
219 | ? -EFAULT : 0; | 221 | ? -EFAULT : 0; |
@@ -400,13 +402,13 @@ static __inline__ void *dev_get_idx(loff_t left) | |||
400 | 402 | ||
401 | void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos) | 403 | void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos) |
402 | { | 404 | { |
403 | down(&atm_dev_mutex); | 405 | mutex_lock(&atm_dev_mutex); |
404 | return *pos ? dev_get_idx(*pos) : (void *) 1; | 406 | return *pos ? dev_get_idx(*pos) : (void *) 1; |
405 | } | 407 | } |
406 | 408 | ||
407 | void atm_dev_seq_stop(struct seq_file *seq, void *v) | 409 | void atm_dev_seq_stop(struct seq_file *seq, void *v) |
408 | { | 410 | { |
409 | up(&atm_dev_mutex); | 411 | mutex_unlock(&atm_dev_mutex); |
410 | } | 412 | } |
411 | 413 | ||
412 | void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 414 | void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
diff --git a/net/atm/resources.h b/net/atm/resources.h index b7fb82a93b42..ac7222fee7a8 100644 --- a/net/atm/resources.h +++ b/net/atm/resources.h | |||
@@ -8,10 +8,11 @@ | |||
8 | 8 | ||
9 | #include <linux/config.h> | 9 | #include <linux/config.h> |
10 | #include <linux/atmdev.h> | 10 | #include <linux/atmdev.h> |
11 | #include <linux/mutex.h> | ||
11 | 12 | ||
12 | 13 | ||
13 | extern struct list_head atm_devs; | 14 | extern struct list_head atm_devs; |
14 | extern struct semaphore atm_dev_mutex; | 15 | extern struct mutex atm_dev_mutex; |
15 | 16 | ||
16 | int atm_dev_ioctl(unsigned int cmd, void __user *arg); | 17 | int atm_dev_ioctl(unsigned int cmd, void __user *arg); |
17 | 18 | ||
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index cbd4020cc84d..4b178b4a2a95 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #define ASSERT_READ_LOCK(x) | 35 | #define ASSERT_READ_LOCK(x) |
36 | #define ASSERT_WRITE_LOCK(x) | 36 | #define ASSERT_WRITE_LOCK(x) |
37 | #include <linux/netfilter_ipv4/listhelp.h> | 37 | #include <linux/netfilter_ipv4/listhelp.h> |
38 | #include <linux/mutex.h> | ||
38 | 39 | ||
39 | #if 0 | 40 | #if 0 |
40 | /* use this for remote debugging | 41 | /* use this for remote debugging |
@@ -81,7 +82,7 @@ static void print_string(char *str) | |||
81 | 82 | ||
82 | 83 | ||
83 | 84 | ||
84 | static DECLARE_MUTEX(ebt_mutex); | 85 | static DEFINE_MUTEX(ebt_mutex); |
85 | static LIST_HEAD(ebt_tables); | 86 | static LIST_HEAD(ebt_tables); |
86 | static LIST_HEAD(ebt_targets); | 87 | static LIST_HEAD(ebt_targets); |
87 | static LIST_HEAD(ebt_matches); | 88 | static LIST_HEAD(ebt_matches); |
@@ -296,18 +297,18 @@ letscontinue: | |||
296 | /* If it succeeds, returns element and locks mutex */ | 297 | /* If it succeeds, returns element and locks mutex */ |
297 | static inline void * | 298 | static inline void * |
298 | find_inlist_lock_noload(struct list_head *head, const char *name, int *error, | 299 | find_inlist_lock_noload(struct list_head *head, const char *name, int *error, |
299 | struct semaphore *mutex) | 300 | struct mutex *mutex) |
300 | { | 301 | { |
301 | void *ret; | 302 | void *ret; |
302 | 303 | ||
303 | *error = down_interruptible(mutex); | 304 | *error = mutex_lock_interruptible(mutex); |
304 | if (*error != 0) | 305 | if (*error != 0) |
305 | return NULL; | 306 | return NULL; |
306 | 307 | ||
307 | ret = list_named_find(head, name); | 308 | ret = list_named_find(head, name); |
308 | if (!ret) { | 309 | if (!ret) { |
309 | *error = -ENOENT; | 310 | *error = -ENOENT; |
310 | up(mutex); | 311 | mutex_unlock(mutex); |
311 | } | 312 | } |
312 | return ret; | 313 | return ret; |
313 | } | 314 | } |
@@ -317,7 +318,7 @@ find_inlist_lock_noload(struct list_head *head, const char *name, int *error, | |||
317 | #else | 318 | #else |
318 | static void * | 319 | static void * |
319 | find_inlist_lock(struct list_head *head, const char *name, const char *prefix, | 320 | find_inlist_lock(struct list_head *head, const char *name, const char *prefix, |
320 | int *error, struct semaphore *mutex) | 321 | int *error, struct mutex *mutex) |
321 | { | 322 | { |
322 | void *ret; | 323 | void *ret; |
323 | 324 | ||
@@ -331,25 +332,25 @@ find_inlist_lock(struct list_head *head, const char *name, const char *prefix, | |||
331 | #endif | 332 | #endif |
332 | 333 | ||
333 | static inline struct ebt_table * | 334 | static inline struct ebt_table * |
334 | find_table_lock(const char *name, int *error, struct semaphore *mutex) | 335 | find_table_lock(const char *name, int *error, struct mutex *mutex) |
335 | { | 336 | { |
336 | return find_inlist_lock(&ebt_tables, name, "ebtable_", error, mutex); | 337 | return find_inlist_lock(&ebt_tables, name, "ebtable_", error, mutex); |
337 | } | 338 | } |
338 | 339 | ||
339 | static inline struct ebt_match * | 340 | static inline struct ebt_match * |
340 | find_match_lock(const char *name, int *error, struct semaphore *mutex) | 341 | find_match_lock(const char *name, int *error, struct mutex *mutex) |
341 | { | 342 | { |
342 | return find_inlist_lock(&ebt_matches, name, "ebt_", error, mutex); | 343 | return find_inlist_lock(&ebt_matches, name, "ebt_", error, mutex); |
343 | } | 344 | } |
344 | 345 | ||
345 | static inline struct ebt_watcher * | 346 | static inline struct ebt_watcher * |
346 | find_watcher_lock(const char *name, int *error, struct semaphore *mutex) | 347 | find_watcher_lock(const char *name, int *error, struct mutex *mutex) |
347 | { | 348 | { |
348 | return find_inlist_lock(&ebt_watchers, name, "ebt_", error, mutex); | 349 | return find_inlist_lock(&ebt_watchers, name, "ebt_", error, mutex); |
349 | } | 350 | } |
350 | 351 | ||
351 | static inline struct ebt_target * | 352 | static inline struct ebt_target * |
352 | find_target_lock(const char *name, int *error, struct semaphore *mutex) | 353 | find_target_lock(const char *name, int *error, struct mutex *mutex) |
353 | { | 354 | { |
354 | return find_inlist_lock(&ebt_targets, name, "ebt_", error, mutex); | 355 | return find_inlist_lock(&ebt_targets, name, "ebt_", error, mutex); |
355 | } | 356 | } |
@@ -369,10 +370,10 @@ ebt_check_match(struct ebt_entry_match *m, struct ebt_entry *e, | |||
369 | return ret; | 370 | return ret; |
370 | m->u.match = match; | 371 | m->u.match = match; |
371 | if (!try_module_get(match->me)) { | 372 | if (!try_module_get(match->me)) { |
372 | up(&ebt_mutex); | 373 | mutex_unlock(&ebt_mutex); |
373 | return -ENOENT; | 374 | return -ENOENT; |
374 | } | 375 | } |
375 | up(&ebt_mutex); | 376 | mutex_unlock(&ebt_mutex); |
376 | if (match->check && | 377 | if (match->check && |
377 | match->check(name, hookmask, e, m->data, m->match_size) != 0) { | 378 | match->check(name, hookmask, e, m->data, m->match_size) != 0) { |
378 | BUGPRINT("match->check failed\n"); | 379 | BUGPRINT("match->check failed\n"); |
@@ -398,10 +399,10 @@ ebt_check_watcher(struct ebt_entry_watcher *w, struct ebt_entry *e, | |||
398 | return ret; | 399 | return ret; |
399 | w->u.watcher = watcher; | 400 | w->u.watcher = watcher; |
400 | if (!try_module_get(watcher->me)) { | 401 | if (!try_module_get(watcher->me)) { |
401 | up(&ebt_mutex); | 402 | mutex_unlock(&ebt_mutex); |
402 | return -ENOENT; | 403 | return -ENOENT; |
403 | } | 404 | } |
404 | up(&ebt_mutex); | 405 | mutex_unlock(&ebt_mutex); |
405 | if (watcher->check && | 406 | if (watcher->check && |
406 | watcher->check(name, hookmask, e, w->data, w->watcher_size) != 0) { | 407 | watcher->check(name, hookmask, e, w->data, w->watcher_size) != 0) { |
407 | BUGPRINT("watcher->check failed\n"); | 408 | BUGPRINT("watcher->check failed\n"); |
@@ -638,11 +639,11 @@ ebt_check_entry(struct ebt_entry *e, struct ebt_table_info *newinfo, | |||
638 | if (!target) | 639 | if (!target) |
639 | goto cleanup_watchers; | 640 | goto cleanup_watchers; |
640 | if (!try_module_get(target->me)) { | 641 | if (!try_module_get(target->me)) { |
641 | up(&ebt_mutex); | 642 | mutex_unlock(&ebt_mutex); |
642 | ret = -ENOENT; | 643 | ret = -ENOENT; |
643 | goto cleanup_watchers; | 644 | goto cleanup_watchers; |
644 | } | 645 | } |
645 | up(&ebt_mutex); | 646 | mutex_unlock(&ebt_mutex); |
646 | 647 | ||
647 | t->u.target = target; | 648 | t->u.target = target; |
648 | if (t->u.target == &ebt_standard_target) { | 649 | if (t->u.target == &ebt_standard_target) { |
@@ -1015,7 +1016,7 @@ static int do_replace(void __user *user, unsigned int len) | |||
1015 | 1016 | ||
1016 | t->private = newinfo; | 1017 | t->private = newinfo; |
1017 | write_unlock_bh(&t->lock); | 1018 | write_unlock_bh(&t->lock); |
1018 | up(&ebt_mutex); | 1019 | mutex_unlock(&ebt_mutex); |
1019 | /* so, a user can change the chains while having messed up her counter | 1020 | /* so, a user can change the chains while having messed up her counter |
1020 | allocation. Only reason why this is done is because this way the lock | 1021 | allocation. Only reason why this is done is because this way the lock |
1021 | is held only once, while this doesn't bring the kernel into a | 1022 | is held only once, while this doesn't bring the kernel into a |
@@ -1045,7 +1046,7 @@ static int do_replace(void __user *user, unsigned int len) | |||
1045 | return ret; | 1046 | return ret; |
1046 | 1047 | ||
1047 | free_unlock: | 1048 | free_unlock: |
1048 | up(&ebt_mutex); | 1049 | mutex_unlock(&ebt_mutex); |
1049 | free_iterate: | 1050 | free_iterate: |
1050 | EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, | 1051 | EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, |
1051 | ebt_cleanup_entry, NULL); | 1052 | ebt_cleanup_entry, NULL); |
@@ -1068,69 +1069,69 @@ int ebt_register_target(struct ebt_target *target) | |||
1068 | { | 1069 | { |
1069 | int ret; | 1070 | int ret; |
1070 | 1071 | ||
1071 | ret = down_interruptible(&ebt_mutex); | 1072 | ret = mutex_lock_interruptible(&ebt_mutex); |
1072 | if (ret != 0) | 1073 | if (ret != 0) |
1073 | return ret; | 1074 | return ret; |
1074 | if (!list_named_insert(&ebt_targets, target)) { | 1075 | if (!list_named_insert(&ebt_targets, target)) { |
1075 | up(&ebt_mutex); | 1076 | mutex_unlock(&ebt_mutex); |
1076 | return -EEXIST; | 1077 | return -EEXIST; |
1077 | } | 1078 | } |
1078 | up(&ebt_mutex); | 1079 | mutex_unlock(&ebt_mutex); |
1079 | 1080 | ||
1080 | return 0; | 1081 | return 0; |
1081 | } | 1082 | } |
1082 | 1083 | ||
1083 | void ebt_unregister_target(struct ebt_target *target) | 1084 | void ebt_unregister_target(struct ebt_target *target) |
1084 | { | 1085 | { |
1085 | down(&ebt_mutex); | 1086 | mutex_lock(&ebt_mutex); |
1086 | LIST_DELETE(&ebt_targets, target); | 1087 | LIST_DELETE(&ebt_targets, target); |
1087 | up(&ebt_mutex); | 1088 | mutex_unlock(&ebt_mutex); |
1088 | } | 1089 | } |
1089 | 1090 | ||
1090 | int ebt_register_match(struct ebt_match *match) | 1091 | int ebt_register_match(struct ebt_match *match) |
1091 | { | 1092 | { |
1092 | int ret; | 1093 | int ret; |
1093 | 1094 | ||
1094 | ret = down_interruptible(&ebt_mutex); | 1095 | ret = mutex_lock_interruptible(&ebt_mutex); |
1095 | if (ret != 0) | 1096 | if (ret != 0) |
1096 | return ret; | 1097 | return ret; |
1097 | if (!list_named_insert(&ebt_matches, match)) { | 1098 | if (!list_named_insert(&ebt_matches, match)) { |
1098 | up(&ebt_mutex); | 1099 | mutex_unlock(&ebt_mutex); |
1099 | return -EEXIST; | 1100 | return -EEXIST; |
1100 | } | 1101 | } |
1101 | up(&ebt_mutex); | 1102 | mutex_unlock(&ebt_mutex); |
1102 | 1103 | ||
1103 | return 0; | 1104 | return 0; |
1104 | } | 1105 | } |
1105 | 1106 | ||
1106 | void ebt_unregister_match(struct ebt_match *match) | 1107 | void ebt_unregister_match(struct ebt_match *match) |
1107 | { | 1108 | { |
1108 | down(&ebt_mutex); | 1109 | mutex_lock(&ebt_mutex); |
1109 | LIST_DELETE(&ebt_matches, match); | 1110 | LIST_DELETE(&ebt_matches, match); |
1110 | up(&ebt_mutex); | 1111 | mutex_unlock(&ebt_mutex); |
1111 | } | 1112 | } |
1112 | 1113 | ||
1113 | int ebt_register_watcher(struct ebt_watcher *watcher) | 1114 | int ebt_register_watcher(struct ebt_watcher *watcher) |
1114 | { | 1115 | { |
1115 | int ret; | 1116 | int ret; |
1116 | 1117 | ||
1117 | ret = down_interruptible(&ebt_mutex); | 1118 | ret = mutex_lock_interruptible(&ebt_mutex); |
1118 | if (ret != 0) | 1119 | if (ret != 0) |
1119 | return ret; | 1120 | return ret; |
1120 | if (!list_named_insert(&ebt_watchers, watcher)) { | 1121 | if (!list_named_insert(&ebt_watchers, watcher)) { |
1121 | up(&ebt_mutex); | 1122 | mutex_unlock(&ebt_mutex); |
1122 | return -EEXIST; | 1123 | return -EEXIST; |
1123 | } | 1124 | } |
1124 | up(&ebt_mutex); | 1125 | mutex_unlock(&ebt_mutex); |
1125 | 1126 | ||
1126 | return 0; | 1127 | return 0; |
1127 | } | 1128 | } |
1128 | 1129 | ||
1129 | void ebt_unregister_watcher(struct ebt_watcher *watcher) | 1130 | void ebt_unregister_watcher(struct ebt_watcher *watcher) |
1130 | { | 1131 | { |
1131 | down(&ebt_mutex); | 1132 | mutex_lock(&ebt_mutex); |
1132 | LIST_DELETE(&ebt_watchers, watcher); | 1133 | LIST_DELETE(&ebt_watchers, watcher); |
1133 | up(&ebt_mutex); | 1134 | mutex_unlock(&ebt_mutex); |
1134 | } | 1135 | } |
1135 | 1136 | ||
1136 | int ebt_register_table(struct ebt_table *table) | 1137 | int ebt_register_table(struct ebt_table *table) |
@@ -1178,7 +1179,7 @@ int ebt_register_table(struct ebt_table *table) | |||
1178 | 1179 | ||
1179 | table->private = newinfo; | 1180 | table->private = newinfo; |
1180 | rwlock_init(&table->lock); | 1181 | rwlock_init(&table->lock); |
1181 | ret = down_interruptible(&ebt_mutex); | 1182 | ret = mutex_lock_interruptible(&ebt_mutex); |
1182 | if (ret != 0) | 1183 | if (ret != 0) |
1183 | goto free_chainstack; | 1184 | goto free_chainstack; |
1184 | 1185 | ||
@@ -1194,10 +1195,10 @@ int ebt_register_table(struct ebt_table *table) | |||
1194 | goto free_unlock; | 1195 | goto free_unlock; |
1195 | } | 1196 | } |
1196 | list_prepend(&ebt_tables, table); | 1197 | list_prepend(&ebt_tables, table); |
1197 | up(&ebt_mutex); | 1198 | mutex_unlock(&ebt_mutex); |
1198 | return 0; | 1199 | return 0; |
1199 | free_unlock: | 1200 | free_unlock: |
1200 | up(&ebt_mutex); | 1201 | mutex_unlock(&ebt_mutex); |
1201 | free_chainstack: | 1202 | free_chainstack: |
1202 | if (newinfo->chainstack) { | 1203 | if (newinfo->chainstack) { |
1203 | for_each_cpu(i) | 1204 | for_each_cpu(i) |
@@ -1218,9 +1219,9 @@ void ebt_unregister_table(struct ebt_table *table) | |||
1218 | BUGPRINT("Request to unregister NULL table!!!\n"); | 1219 | BUGPRINT("Request to unregister NULL table!!!\n"); |
1219 | return; | 1220 | return; |
1220 | } | 1221 | } |
1221 | down(&ebt_mutex); | 1222 | mutex_lock(&ebt_mutex); |
1222 | LIST_DELETE(&ebt_tables, table); | 1223 | LIST_DELETE(&ebt_tables, table); |
1223 | up(&ebt_mutex); | 1224 | mutex_unlock(&ebt_mutex); |
1224 | vfree(table->private->entries); | 1225 | vfree(table->private->entries); |
1225 | if (table->private->chainstack) { | 1226 | if (table->private->chainstack) { |
1226 | for_each_cpu(i) | 1227 | for_each_cpu(i) |
@@ -1281,7 +1282,7 @@ static int update_counters(void __user *user, unsigned int len) | |||
1281 | write_unlock_bh(&t->lock); | 1282 | write_unlock_bh(&t->lock); |
1282 | ret = 0; | 1283 | ret = 0; |
1283 | unlock_mutex: | 1284 | unlock_mutex: |
1284 | up(&ebt_mutex); | 1285 | mutex_unlock(&ebt_mutex); |
1285 | free_tmp: | 1286 | free_tmp: |
1286 | vfree(tmp); | 1287 | vfree(tmp); |
1287 | return ret; | 1288 | return ret; |
@@ -1328,7 +1329,7 @@ static inline int ebt_make_names(struct ebt_entry *e, char *base, char *ubase) | |||
1328 | return 0; | 1329 | return 0; |
1329 | } | 1330 | } |
1330 | 1331 | ||
1331 | /* called with ebt_mutex down */ | 1332 | /* called with ebt_mutex locked */ |
1332 | static int copy_everything_to_user(struct ebt_table *t, void __user *user, | 1333 | static int copy_everything_to_user(struct ebt_table *t, void __user *user, |
1333 | int *len, int cmd) | 1334 | int *len, int cmd) |
1334 | { | 1335 | { |
@@ -1440,7 +1441,7 @@ static int do_ebt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) | |||
1440 | case EBT_SO_GET_INIT_INFO: | 1441 | case EBT_SO_GET_INIT_INFO: |
1441 | if (*len != sizeof(struct ebt_replace)){ | 1442 | if (*len != sizeof(struct ebt_replace)){ |
1442 | ret = -EINVAL; | 1443 | ret = -EINVAL; |
1443 | up(&ebt_mutex); | 1444 | mutex_unlock(&ebt_mutex); |
1444 | break; | 1445 | break; |
1445 | } | 1446 | } |
1446 | if (cmd == EBT_SO_GET_INFO) { | 1447 | if (cmd == EBT_SO_GET_INFO) { |
@@ -1452,7 +1453,7 @@ static int do_ebt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) | |||
1452 | tmp.entries_size = t->table->entries_size; | 1453 | tmp.entries_size = t->table->entries_size; |
1453 | tmp.valid_hooks = t->table->valid_hooks; | 1454 | tmp.valid_hooks = t->table->valid_hooks; |
1454 | } | 1455 | } |
1455 | up(&ebt_mutex); | 1456 | mutex_unlock(&ebt_mutex); |
1456 | if (copy_to_user(user, &tmp, *len) != 0){ | 1457 | if (copy_to_user(user, &tmp, *len) != 0){ |
1457 | BUGPRINT("c2u Didn't work\n"); | 1458 | BUGPRINT("c2u Didn't work\n"); |
1458 | ret = -EFAULT; | 1459 | ret = -EFAULT; |
@@ -1464,11 +1465,11 @@ static int do_ebt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) | |||
1464 | case EBT_SO_GET_ENTRIES: | 1465 | case EBT_SO_GET_ENTRIES: |
1465 | case EBT_SO_GET_INIT_ENTRIES: | 1466 | case EBT_SO_GET_INIT_ENTRIES: |
1466 | ret = copy_everything_to_user(t, user, len, cmd); | 1467 | ret = copy_everything_to_user(t, user, len, cmd); |
1467 | up(&ebt_mutex); | 1468 | mutex_unlock(&ebt_mutex); |
1468 | break; | 1469 | break; |
1469 | 1470 | ||
1470 | default: | 1471 | default: |
1471 | up(&ebt_mutex); | 1472 | mutex_unlock(&ebt_mutex); |
1472 | ret = -EINVAL; | 1473 | ret = -EINVAL; |
1473 | } | 1474 | } |
1474 | 1475 | ||
@@ -1484,9 +1485,9 @@ static int __init init(void) | |||
1484 | { | 1485 | { |
1485 | int ret; | 1486 | int ret; |
1486 | 1487 | ||
1487 | down(&ebt_mutex); | 1488 | mutex_lock(&ebt_mutex); |
1488 | list_named_insert(&ebt_targets, &ebt_standard_target); | 1489 | list_named_insert(&ebt_targets, &ebt_standard_target); |
1489 | up(&ebt_mutex); | 1490 | mutex_unlock(&ebt_mutex); |
1490 | if ((ret = nf_register_sockopt(&ebt_sockopts)) < 0) | 1491 | if ((ret = nf_register_sockopt(&ebt_sockopts)) < 0) |
1491 | return ret; | 1492 | return ret; |
1492 | 1493 | ||
diff --git a/net/ipv4/ipvs/ip_vs_app.c b/net/ipv4/ipvs/ip_vs_app.c index 9b176a942ac5..e7752334d296 100644 --- a/net/ipv4/ipvs/ip_vs_app.c +++ b/net/ipv4/ipvs/ip_vs_app.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/stat.h> | 31 | #include <linux/stat.h> |
32 | #include <linux/proc_fs.h> | 32 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
34 | #include <linux/mutex.h> | ||
34 | 35 | ||
35 | #include <net/ip_vs.h> | 36 | #include <net/ip_vs.h> |
36 | 37 | ||
@@ -40,7 +41,7 @@ EXPORT_SYMBOL(register_ip_vs_app_inc); | |||
40 | 41 | ||
41 | /* ipvs application list head */ | 42 | /* ipvs application list head */ |
42 | static LIST_HEAD(ip_vs_app_list); | 43 | static LIST_HEAD(ip_vs_app_list); |
43 | static DECLARE_MUTEX(__ip_vs_app_mutex); | 44 | static DEFINE_MUTEX(__ip_vs_app_mutex); |
44 | 45 | ||
45 | 46 | ||
46 | /* | 47 | /* |
@@ -173,11 +174,11 @@ register_ip_vs_app_inc(struct ip_vs_app *app, __u16 proto, __u16 port) | |||
173 | { | 174 | { |
174 | int result; | 175 | int result; |
175 | 176 | ||
176 | down(&__ip_vs_app_mutex); | 177 | mutex_lock(&__ip_vs_app_mutex); |
177 | 178 | ||
178 | result = ip_vs_app_inc_new(app, proto, port); | 179 | result = ip_vs_app_inc_new(app, proto, port); |
179 | 180 | ||
180 | up(&__ip_vs_app_mutex); | 181 | mutex_unlock(&__ip_vs_app_mutex); |
181 | 182 | ||
182 | return result; | 183 | return result; |
183 | } | 184 | } |
@@ -191,11 +192,11 @@ int register_ip_vs_app(struct ip_vs_app *app) | |||
191 | /* increase the module use count */ | 192 | /* increase the module use count */ |
192 | ip_vs_use_count_inc(); | 193 | ip_vs_use_count_inc(); |
193 | 194 | ||
194 | down(&__ip_vs_app_mutex); | 195 | mutex_lock(&__ip_vs_app_mutex); |
195 | 196 | ||
196 | list_add(&app->a_list, &ip_vs_app_list); | 197 | list_add(&app->a_list, &ip_vs_app_list); |
197 | 198 | ||
198 | up(&__ip_vs_app_mutex); | 199 | mutex_unlock(&__ip_vs_app_mutex); |
199 | 200 | ||
200 | return 0; | 201 | return 0; |
201 | } | 202 | } |
@@ -209,7 +210,7 @@ void unregister_ip_vs_app(struct ip_vs_app *app) | |||
209 | { | 210 | { |
210 | struct ip_vs_app *inc, *nxt; | 211 | struct ip_vs_app *inc, *nxt; |
211 | 212 | ||
212 | down(&__ip_vs_app_mutex); | 213 | mutex_lock(&__ip_vs_app_mutex); |
213 | 214 | ||
214 | list_for_each_entry_safe(inc, nxt, &app->incs_list, a_list) { | 215 | list_for_each_entry_safe(inc, nxt, &app->incs_list, a_list) { |
215 | ip_vs_app_inc_release(inc); | 216 | ip_vs_app_inc_release(inc); |
@@ -217,7 +218,7 @@ void unregister_ip_vs_app(struct ip_vs_app *app) | |||
217 | 218 | ||
218 | list_del(&app->a_list); | 219 | list_del(&app->a_list); |
219 | 220 | ||
220 | up(&__ip_vs_app_mutex); | 221 | mutex_unlock(&__ip_vs_app_mutex); |
221 | 222 | ||
222 | /* decrease the module use count */ | 223 | /* decrease the module use count */ |
223 | ip_vs_use_count_dec(); | 224 | ip_vs_use_count_dec(); |
@@ -498,7 +499,7 @@ static struct ip_vs_app *ip_vs_app_idx(loff_t pos) | |||
498 | 499 | ||
499 | static void *ip_vs_app_seq_start(struct seq_file *seq, loff_t *pos) | 500 | static void *ip_vs_app_seq_start(struct seq_file *seq, loff_t *pos) |
500 | { | 501 | { |
501 | down(&__ip_vs_app_mutex); | 502 | mutex_lock(&__ip_vs_app_mutex); |
502 | 503 | ||
503 | return *pos ? ip_vs_app_idx(*pos - 1) : SEQ_START_TOKEN; | 504 | return *pos ? ip_vs_app_idx(*pos - 1) : SEQ_START_TOKEN; |
504 | } | 505 | } |
@@ -530,7 +531,7 @@ static void *ip_vs_app_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
530 | 531 | ||
531 | static void ip_vs_app_seq_stop(struct seq_file *seq, void *v) | 532 | static void ip_vs_app_seq_stop(struct seq_file *seq, void *v) |
532 | { | 533 | { |
533 | up(&__ip_vs_app_mutex); | 534 | mutex_unlock(&__ip_vs_app_mutex); |
534 | } | 535 | } |
535 | 536 | ||
536 | static int ip_vs_app_seq_show(struct seq_file *seq, void *v) | 537 | static int ip_vs_app_seq_show(struct seq_file *seq, void *v) |
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index 9423bd0f070a..f7efb3f27bf5 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | 23 | ||
24 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
25 | #include <asm/semaphore.h> | 25 | #include <linux/mutex.h> |
26 | 26 | ||
27 | #include <linux/netfilter/x_tables.h> | 27 | #include <linux/netfilter/x_tables.h> |
28 | #include <linux/netfilter_arp/arp_tables.h> | 28 | #include <linux/netfilter_arp/arp_tables.h> |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index cf5b9db05371..39705f9bc154 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/icmp.h> | 25 | #include <linux/icmp.h> |
26 | #include <net/ip.h> | 26 | #include <net/ip.h> |
27 | #include <asm/uaccess.h> | 27 | #include <asm/uaccess.h> |
28 | #include <asm/semaphore.h> | 28 | #include <linux/mutex.h> |
29 | #include <linux/proc_fs.h> | 29 | #include <linux/proc_fs.h> |
30 | #include <linux/err.h> | 30 | #include <linux/err.h> |
31 | #include <linux/cpumask.h> | 31 | #include <linux/cpumask.h> |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index d74ec335743e..5a2063bda676 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <linux/icmpv6.h> | 29 | #include <linux/icmpv6.h> |
30 | #include <net/ipv6.h> | 30 | #include <net/ipv6.h> |
31 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
32 | #include <asm/semaphore.h> | 32 | #include <linux/mutex.h> |
33 | #include <linux/proc_fs.h> | 33 | #include <linux/proc_fs.h> |
34 | #include <linux/cpumask.h> | 34 | #include <linux/cpumask.h> |
35 | 35 | ||
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index dc68d0022218..f6498234e264 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -185,7 +185,7 @@ static struct { | |||
185 | DEFINE_RWLOCK(nf_ct_cache_lock); | 185 | DEFINE_RWLOCK(nf_ct_cache_lock); |
186 | 186 | ||
187 | /* This avoids calling kmem_cache_create() with same name simultaneously */ | 187 | /* This avoids calling kmem_cache_create() with same name simultaneously */ |
188 | DECLARE_MUTEX(nf_ct_cache_mutex); | 188 | static DEFINE_MUTEX(nf_ct_cache_mutex); |
189 | 189 | ||
190 | extern struct nf_conntrack_protocol nf_conntrack_generic_protocol; | 190 | extern struct nf_conntrack_protocol nf_conntrack_generic_protocol; |
191 | struct nf_conntrack_protocol * | 191 | struct nf_conntrack_protocol * |
@@ -278,7 +278,7 @@ int nf_conntrack_register_cache(u_int32_t features, const char *name, | |||
278 | return -EINVAL; | 278 | return -EINVAL; |
279 | } | 279 | } |
280 | 280 | ||
281 | down(&nf_ct_cache_mutex); | 281 | mutex_lock(&nf_ct_cache_mutex); |
282 | 282 | ||
283 | write_lock_bh(&nf_ct_cache_lock); | 283 | write_lock_bh(&nf_ct_cache_lock); |
284 | /* e.g: multiple helpers are loaded */ | 284 | /* e.g: multiple helpers are loaded */ |
@@ -294,7 +294,7 @@ int nf_conntrack_register_cache(u_int32_t features, const char *name, | |||
294 | ret = -EBUSY; | 294 | ret = -EBUSY; |
295 | 295 | ||
296 | write_unlock_bh(&nf_ct_cache_lock); | 296 | write_unlock_bh(&nf_ct_cache_lock); |
297 | up(&nf_ct_cache_mutex); | 297 | mutex_unlock(&nf_ct_cache_mutex); |
298 | return ret; | 298 | return ret; |
299 | } | 299 | } |
300 | write_unlock_bh(&nf_ct_cache_lock); | 300 | write_unlock_bh(&nf_ct_cache_lock); |
@@ -338,7 +338,7 @@ int nf_conntrack_register_cache(u_int32_t features, const char *name, | |||
338 | out_free_name: | 338 | out_free_name: |
339 | kfree(cache_name); | 339 | kfree(cache_name); |
340 | out_up_mutex: | 340 | out_up_mutex: |
341 | up(&nf_ct_cache_mutex); | 341 | mutex_unlock(&nf_ct_cache_mutex); |
342 | return ret; | 342 | return ret; |
343 | } | 343 | } |
344 | 344 | ||
@@ -353,12 +353,12 @@ void nf_conntrack_unregister_cache(u_int32_t features) | |||
353 | * slab cache. | 353 | * slab cache. |
354 | */ | 354 | */ |
355 | DEBUGP("nf_conntrack_unregister_cache: 0x%04x\n", features); | 355 | DEBUGP("nf_conntrack_unregister_cache: 0x%04x\n", features); |
356 | down(&nf_ct_cache_mutex); | 356 | mutex_lock(&nf_ct_cache_mutex); |
357 | 357 | ||
358 | write_lock_bh(&nf_ct_cache_lock); | 358 | write_lock_bh(&nf_ct_cache_lock); |
359 | if (--nf_ct_cache[features].use > 0) { | 359 | if (--nf_ct_cache[features].use > 0) { |
360 | write_unlock_bh(&nf_ct_cache_lock); | 360 | write_unlock_bh(&nf_ct_cache_lock); |
361 | up(&nf_ct_cache_mutex); | 361 | mutex_unlock(&nf_ct_cache_mutex); |
362 | return; | 362 | return; |
363 | } | 363 | } |
364 | cachep = nf_ct_cache[features].cachep; | 364 | cachep = nf_ct_cache[features].cachep; |
@@ -373,7 +373,7 @@ void nf_conntrack_unregister_cache(u_int32_t features) | |||
373 | kmem_cache_destroy(cachep); | 373 | kmem_cache_destroy(cachep); |
374 | kfree(name); | 374 | kfree(name); |
375 | 375 | ||
376 | up(&nf_ct_cache_mutex); | 376 | mutex_unlock(&nf_ct_cache_mutex); |
377 | } | 377 | } |
378 | 378 | ||
379 | int | 379 | int |
@@ -1408,6 +1408,8 @@ void __nf_ct_refresh_acct(struct nf_conn *ct, | |||
1408 | 1408 | ||
1409 | #include <linux/netfilter/nfnetlink.h> | 1409 | #include <linux/netfilter/nfnetlink.h> |
1410 | #include <linux/netfilter/nfnetlink_conntrack.h> | 1410 | #include <linux/netfilter/nfnetlink_conntrack.h> |
1411 | #include <linux/mutex.h> | ||
1412 | |||
1411 | 1413 | ||
1412 | /* Generic function for tcp/udp/sctp/dccp and alike. This needs to be | 1414 | /* Generic function for tcp/udp/sctp/dccp and alike. This needs to be |
1413 | * in ip_conntrack_core, since we don't want the protocols to autoload | 1415 | * in ip_conntrack_core, since we don't want the protocols to autoload |
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 50580620e897..a27905a0ad27 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -1296,13 +1296,13 @@ svc_send(struct svc_rqst *rqstp) | |||
1296 | xb->page_len + | 1296 | xb->page_len + |
1297 | xb->tail[0].iov_len; | 1297 | xb->tail[0].iov_len; |
1298 | 1298 | ||
1299 | /* Grab svsk->sk_sem to serialize outgoing data. */ | 1299 | /* Grab svsk->sk_mutex to serialize outgoing data. */ |
1300 | down(&svsk->sk_sem); | 1300 | mutex_lock(&svsk->sk_mutex); |
1301 | if (test_bit(SK_DEAD, &svsk->sk_flags)) | 1301 | if (test_bit(SK_DEAD, &svsk->sk_flags)) |
1302 | len = -ENOTCONN; | 1302 | len = -ENOTCONN; |
1303 | else | 1303 | else |
1304 | len = svsk->sk_sendto(rqstp); | 1304 | len = svsk->sk_sendto(rqstp); |
1305 | up(&svsk->sk_sem); | 1305 | mutex_unlock(&svsk->sk_mutex); |
1306 | svc_sock_release(rqstp); | 1306 | svc_sock_release(rqstp); |
1307 | 1307 | ||
1308 | if (len == -ECONNREFUSED || len == -ENOTCONN || len == -EAGAIN) | 1308 | if (len == -ECONNREFUSED || len == -ENOTCONN || len == -EAGAIN) |
@@ -1351,7 +1351,7 @@ svc_setup_socket(struct svc_serv *serv, struct socket *sock, | |||
1351 | svsk->sk_lastrecv = get_seconds(); | 1351 | svsk->sk_lastrecv = get_seconds(); |
1352 | INIT_LIST_HEAD(&svsk->sk_deferred); | 1352 | INIT_LIST_HEAD(&svsk->sk_deferred); |
1353 | INIT_LIST_HEAD(&svsk->sk_ready); | 1353 | INIT_LIST_HEAD(&svsk->sk_ready); |
1354 | sema_init(&svsk->sk_sem, 1); | 1354 | mutex_init(&svsk->sk_mutex); |
1355 | 1355 | ||
1356 | /* Initialize the socket */ | 1356 | /* Initialize the socket */ |
1357 | if (sock->type == SOCK_DGRAM) | 1357 | if (sock->type == SOCK_DGRAM) |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 2b00460f2886..2b4cc2eea5b3 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -566,7 +566,7 @@ static struct sock * unix_create1(struct socket *sock) | |||
566 | u->mnt = NULL; | 566 | u->mnt = NULL; |
567 | spin_lock_init(&u->lock); | 567 | spin_lock_init(&u->lock); |
568 | atomic_set(&u->inflight, sock ? 0 : -1); | 568 | atomic_set(&u->inflight, sock ? 0 : -1); |
569 | init_MUTEX(&u->readsem); /* single task reading lock */ | 569 | mutex_init(&u->readlock); /* single task reading lock */ |
570 | init_waitqueue_head(&u->peer_wait); | 570 | init_waitqueue_head(&u->peer_wait); |
571 | unix_insert_socket(unix_sockets_unbound, sk); | 571 | unix_insert_socket(unix_sockets_unbound, sk); |
572 | out: | 572 | out: |
@@ -623,7 +623,7 @@ static int unix_autobind(struct socket *sock) | |||
623 | struct unix_address * addr; | 623 | struct unix_address * addr; |
624 | int err; | 624 | int err; |
625 | 625 | ||
626 | down(&u->readsem); | 626 | mutex_lock(&u->readlock); |
627 | 627 | ||
628 | err = 0; | 628 | err = 0; |
629 | if (u->addr) | 629 | if (u->addr) |
@@ -661,7 +661,7 @@ retry: | |||
661 | spin_unlock(&unix_table_lock); | 661 | spin_unlock(&unix_table_lock); |
662 | err = 0; | 662 | err = 0; |
663 | 663 | ||
664 | out: up(&u->readsem); | 664 | out: mutex_unlock(&u->readlock); |
665 | return err; | 665 | return err; |
666 | } | 666 | } |
667 | 667 | ||
@@ -744,7 +744,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
744 | goto out; | 744 | goto out; |
745 | addr_len = err; | 745 | addr_len = err; |
746 | 746 | ||
747 | down(&u->readsem); | 747 | mutex_lock(&u->readlock); |
748 | 748 | ||
749 | err = -EINVAL; | 749 | err = -EINVAL; |
750 | if (u->addr) | 750 | if (u->addr) |
@@ -816,7 +816,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
816 | out_unlock: | 816 | out_unlock: |
817 | spin_unlock(&unix_table_lock); | 817 | spin_unlock(&unix_table_lock); |
818 | out_up: | 818 | out_up: |
819 | up(&u->readsem); | 819 | mutex_unlock(&u->readlock); |
820 | out: | 820 | out: |
821 | return err; | 821 | return err; |
822 | 822 | ||
@@ -1545,7 +1545,7 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1545 | 1545 | ||
1546 | msg->msg_namelen = 0; | 1546 | msg->msg_namelen = 0; |
1547 | 1547 | ||
1548 | down(&u->readsem); | 1548 | mutex_lock(&u->readlock); |
1549 | 1549 | ||
1550 | skb = skb_recv_datagram(sk, flags, noblock, &err); | 1550 | skb = skb_recv_datagram(sk, flags, noblock, &err); |
1551 | if (!skb) | 1551 | if (!skb) |
@@ -1600,7 +1600,7 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1600 | out_free: | 1600 | out_free: |
1601 | skb_free_datagram(sk,skb); | 1601 | skb_free_datagram(sk,skb); |
1602 | out_unlock: | 1602 | out_unlock: |
1603 | up(&u->readsem); | 1603 | mutex_unlock(&u->readlock); |
1604 | out: | 1604 | out: |
1605 | return err; | 1605 | return err; |
1606 | } | 1606 | } |
@@ -1676,7 +1676,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1676 | memset(&tmp_scm, 0, sizeof(tmp_scm)); | 1676 | memset(&tmp_scm, 0, sizeof(tmp_scm)); |
1677 | } | 1677 | } |
1678 | 1678 | ||
1679 | down(&u->readsem); | 1679 | mutex_lock(&u->readlock); |
1680 | 1680 | ||
1681 | do | 1681 | do |
1682 | { | 1682 | { |
@@ -1700,7 +1700,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1700 | err = -EAGAIN; | 1700 | err = -EAGAIN; |
1701 | if (!timeo) | 1701 | if (!timeo) |
1702 | break; | 1702 | break; |
1703 | up(&u->readsem); | 1703 | mutex_unlock(&u->readlock); |
1704 | 1704 | ||
1705 | timeo = unix_stream_data_wait(sk, timeo); | 1705 | timeo = unix_stream_data_wait(sk, timeo); |
1706 | 1706 | ||
@@ -1708,7 +1708,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1708 | err = sock_intr_errno(timeo); | 1708 | err = sock_intr_errno(timeo); |
1709 | goto out; | 1709 | goto out; |
1710 | } | 1710 | } |
1711 | down(&u->readsem); | 1711 | mutex_lock(&u->readlock); |
1712 | continue; | 1712 | continue; |
1713 | } | 1713 | } |
1714 | 1714 | ||
@@ -1774,7 +1774,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1774 | } | 1774 | } |
1775 | } while (size); | 1775 | } while (size); |
1776 | 1776 | ||
1777 | up(&u->readsem); | 1777 | mutex_unlock(&u->readlock); |
1778 | scm_recv(sock, msg, siocb->scm, flags); | 1778 | scm_recv(sock, msg, siocb->scm, flags); |
1779 | out: | 1779 | out: |
1780 | return copied ? : err; | 1780 | return copied ? : err; |