diff options
author | Michal Marek <mmarek@suse.cz> | 2010-08-04 07:59:13 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2010-08-04 07:59:13 -0400 |
commit | 772320e84588dcbe1600ffb83e5f328f2209ac2a (patch) | |
tree | a7de21b79340aeaa17c58126f6b801b82c77b53a /net/unix | |
parent | 1ce53adf13a54375d2a5c7cdbe341b2558389615 (diff) | |
parent | 9fe6206f400646a2322096b56c59891d530e8d51 (diff) |
Merge commit 'v2.6.35' into kbuild/kbuild
Conflicts:
arch/powerpc/Makefile
Diffstat (limited to 'net/unix')
-rw-r--r-- | net/unix/af_unix.c | 31 | ||||
-rw-r--r-- | net/unix/garbage.c | 14 | ||||
-rw-r--r-- | net/unix/sysctl_net_unix.c | 3 |
3 files changed, 19 insertions, 29 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index f25511903115..fef2cc5e9d2b 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -144,7 +144,7 @@ static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) | |||
144 | /* | 144 | /* |
145 | * SMP locking strategy: | 145 | * SMP locking strategy: |
146 | * hash table is protected with spinlock unix_table_lock | 146 | * hash table is protected with spinlock unix_table_lock |
147 | * each socket state is protected by separate rwlock. | 147 | * each socket state is protected by separate spin lock. |
148 | */ | 148 | */ |
149 | 149 | ||
150 | static inline unsigned unix_hash_fold(__wsum n) | 150 | static inline unsigned unix_hash_fold(__wsum n) |
@@ -313,13 +313,16 @@ static inline int unix_writable(struct sock *sk) | |||
313 | 313 | ||
314 | static void unix_write_space(struct sock *sk) | 314 | static void unix_write_space(struct sock *sk) |
315 | { | 315 | { |
316 | read_lock(&sk->sk_callback_lock); | 316 | struct socket_wq *wq; |
317 | |||
318 | rcu_read_lock(); | ||
317 | if (unix_writable(sk)) { | 319 | if (unix_writable(sk)) { |
318 | if (sk_has_sleeper(sk)) | 320 | wq = rcu_dereference(sk->sk_wq); |
319 | wake_up_interruptible_sync(sk->sk_sleep); | 321 | if (wq_has_sleeper(wq)) |
322 | wake_up_interruptible_sync(&wq->wait); | ||
320 | sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); | 323 | sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); |
321 | } | 324 | } |
322 | read_unlock(&sk->sk_callback_lock); | 325 | rcu_read_unlock(); |
323 | } | 326 | } |
324 | 327 | ||
325 | /* When dgram socket disconnects (or changes its peer), we clear its receive | 328 | /* When dgram socket disconnects (or changes its peer), we clear its receive |
@@ -406,9 +409,7 @@ static int unix_release_sock(struct sock *sk, int embrion) | |||
406 | skpair->sk_err = ECONNRESET; | 409 | skpair->sk_err = ECONNRESET; |
407 | unix_state_unlock(skpair); | 410 | unix_state_unlock(skpair); |
408 | skpair->sk_state_change(skpair); | 411 | skpair->sk_state_change(skpair); |
409 | read_lock(&skpair->sk_callback_lock); | ||
410 | sk_wake_async(skpair, SOCK_WAKE_WAITD, POLL_HUP); | 412 | sk_wake_async(skpair, SOCK_WAKE_WAITD, POLL_HUP); |
411 | read_unlock(&skpair->sk_callback_lock); | ||
412 | } | 413 | } |
413 | sock_put(skpair); /* It may now die */ | 414 | sock_put(skpair); /* It may now die */ |
414 | unix_peer(sk) = NULL; | 415 | unix_peer(sk) = NULL; |
@@ -1142,7 +1143,7 @@ restart: | |||
1142 | newsk->sk_peercred.pid = task_tgid_vnr(current); | 1143 | newsk->sk_peercred.pid = task_tgid_vnr(current); |
1143 | current_euid_egid(&newsk->sk_peercred.uid, &newsk->sk_peercred.gid); | 1144 | current_euid_egid(&newsk->sk_peercred.uid, &newsk->sk_peercred.gid); |
1144 | newu = unix_sk(newsk); | 1145 | newu = unix_sk(newsk); |
1145 | newsk->sk_sleep = &newu->peer_wait; | 1146 | newsk->sk_wq = &newu->peer_wq; |
1146 | otheru = unix_sk(other); | 1147 | otheru = unix_sk(other); |
1147 | 1148 | ||
1148 | /* copy address information from listening to new sock*/ | 1149 | /* copy address information from listening to new sock*/ |
@@ -1736,7 +1737,7 @@ static long unix_stream_data_wait(struct sock *sk, long timeo) | |||
1736 | unix_state_lock(sk); | 1737 | unix_state_lock(sk); |
1737 | 1738 | ||
1738 | for (;;) { | 1739 | for (;;) { |
1739 | prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); | 1740 | prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
1740 | 1741 | ||
1741 | if (!skb_queue_empty(&sk->sk_receive_queue) || | 1742 | if (!skb_queue_empty(&sk->sk_receive_queue) || |
1742 | sk->sk_err || | 1743 | sk->sk_err || |
@@ -1752,7 +1753,7 @@ static long unix_stream_data_wait(struct sock *sk, long timeo) | |||
1752 | clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); | 1753 | clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); |
1753 | } | 1754 | } |
1754 | 1755 | ||
1755 | finish_wait(sk->sk_sleep, &wait); | 1756 | finish_wait(sk_sleep(sk), &wait); |
1756 | unix_state_unlock(sk); | 1757 | unix_state_unlock(sk); |
1757 | return timeo; | 1758 | return timeo; |
1758 | } | 1759 | } |
@@ -1931,12 +1932,10 @@ static int unix_shutdown(struct socket *sock, int mode) | |||
1931 | other->sk_shutdown |= peer_mode; | 1932 | other->sk_shutdown |= peer_mode; |
1932 | unix_state_unlock(other); | 1933 | unix_state_unlock(other); |
1933 | other->sk_state_change(other); | 1934 | other->sk_state_change(other); |
1934 | read_lock(&other->sk_callback_lock); | ||
1935 | if (peer_mode == SHUTDOWN_MASK) | 1935 | if (peer_mode == SHUTDOWN_MASK) |
1936 | sk_wake_async(other, SOCK_WAKE_WAITD, POLL_HUP); | 1936 | sk_wake_async(other, SOCK_WAKE_WAITD, POLL_HUP); |
1937 | else if (peer_mode & RCV_SHUTDOWN) | 1937 | else if (peer_mode & RCV_SHUTDOWN) |
1938 | sk_wake_async(other, SOCK_WAKE_WAITD, POLL_IN); | 1938 | sk_wake_async(other, SOCK_WAKE_WAITD, POLL_IN); |
1939 | read_unlock(&other->sk_callback_lock); | ||
1940 | } | 1939 | } |
1941 | if (other) | 1940 | if (other) |
1942 | sock_put(other); | 1941 | sock_put(other); |
@@ -1991,7 +1990,7 @@ static unsigned int unix_poll(struct file *file, struct socket *sock, poll_table | |||
1991 | struct sock *sk = sock->sk; | 1990 | struct sock *sk = sock->sk; |
1992 | unsigned int mask; | 1991 | unsigned int mask; |
1993 | 1992 | ||
1994 | sock_poll_wait(file, sk->sk_sleep, wait); | 1993 | sock_poll_wait(file, sk_sleep(sk), wait); |
1995 | mask = 0; | 1994 | mask = 0; |
1996 | 1995 | ||
1997 | /* exceptional events? */ | 1996 | /* exceptional events? */ |
@@ -2028,7 +2027,7 @@ static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, | |||
2028 | struct sock *sk = sock->sk, *other; | 2027 | struct sock *sk = sock->sk, *other; |
2029 | unsigned int mask, writable; | 2028 | unsigned int mask, writable; |
2030 | 2029 | ||
2031 | sock_poll_wait(file, sk->sk_sleep, wait); | 2030 | sock_poll_wait(file, sk_sleep(sk), wait); |
2032 | mask = 0; | 2031 | mask = 0; |
2033 | 2032 | ||
2034 | /* exceptional events? */ | 2033 | /* exceptional events? */ |
@@ -2224,7 +2223,7 @@ static const struct net_proto_family unix_family_ops = { | |||
2224 | }; | 2223 | }; |
2225 | 2224 | ||
2226 | 2225 | ||
2227 | static int unix_net_init(struct net *net) | 2226 | static int __net_init unix_net_init(struct net *net) |
2228 | { | 2227 | { |
2229 | int error = -ENOMEM; | 2228 | int error = -ENOMEM; |
2230 | 2229 | ||
@@ -2243,7 +2242,7 @@ out: | |||
2243 | return error; | 2242 | return error; |
2244 | } | 2243 | } |
2245 | 2244 | ||
2246 | static void unix_net_exit(struct net *net) | 2245 | static void __net_exit unix_net_exit(struct net *net) |
2247 | { | 2246 | { |
2248 | unix_sysctl_unregister(net); | 2247 | unix_sysctl_unregister(net); |
2249 | proc_net_remove(net, "unix"); | 2248 | proc_net_remove(net, "unix"); |
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 19c17e4a0c8b..c8df6fda0b1f 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c | |||
@@ -74,7 +74,6 @@ | |||
74 | #include <linux/un.h> | 74 | #include <linux/un.h> |
75 | #include <linux/net.h> | 75 | #include <linux/net.h> |
76 | #include <linux/fs.h> | 76 | #include <linux/fs.h> |
77 | #include <linux/slab.h> | ||
78 | #include <linux/skbuff.h> | 77 | #include <linux/skbuff.h> |
79 | #include <linux/netdevice.h> | 78 | #include <linux/netdevice.h> |
80 | #include <linux/file.h> | 79 | #include <linux/file.h> |
@@ -154,15 +153,6 @@ void unix_notinflight(struct file *fp) | |||
154 | } | 153 | } |
155 | } | 154 | } |
156 | 155 | ||
157 | static inline struct sk_buff *sock_queue_head(struct sock *sk) | ||
158 | { | ||
159 | return (struct sk_buff *)&sk->sk_receive_queue; | ||
160 | } | ||
161 | |||
162 | #define receive_queue_for_each_skb(sk, next, skb) \ | ||
163 | for (skb = sock_queue_head(sk)->next, next = skb->next; \ | ||
164 | skb != sock_queue_head(sk); skb = next, next = skb->next) | ||
165 | |||
166 | static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *), | 156 | static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *), |
167 | struct sk_buff_head *hitlist) | 157 | struct sk_buff_head *hitlist) |
168 | { | 158 | { |
@@ -170,7 +160,7 @@ static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *), | |||
170 | struct sk_buff *next; | 160 | struct sk_buff *next; |
171 | 161 | ||
172 | spin_lock(&x->sk_receive_queue.lock); | 162 | spin_lock(&x->sk_receive_queue.lock); |
173 | receive_queue_for_each_skb(x, next, skb) { | 163 | skb_queue_walk_safe(&x->sk_receive_queue, skb, next) { |
174 | /* | 164 | /* |
175 | * Do we have file descriptors ? | 165 | * Do we have file descriptors ? |
176 | */ | 166 | */ |
@@ -226,7 +216,7 @@ static void scan_children(struct sock *x, void (*func)(struct unix_sock *), | |||
226 | * and perform a scan on them as well. | 216 | * and perform a scan on them as well. |
227 | */ | 217 | */ |
228 | spin_lock(&x->sk_receive_queue.lock); | 218 | spin_lock(&x->sk_receive_queue.lock); |
229 | receive_queue_for_each_skb(x, next, skb) { | 219 | skb_queue_walk_safe(&x->sk_receive_queue, skb, next) { |
230 | u = unix_sk(skb->sk); | 220 | u = unix_sk(skb->sk); |
231 | 221 | ||
232 | /* | 222 | /* |
diff --git a/net/unix/sysctl_net_unix.c b/net/unix/sysctl_net_unix.c index 708f5df6b7f0..397cffebb3b6 100644 --- a/net/unix/sysctl_net_unix.c +++ b/net/unix/sysctl_net_unix.c | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
13 | #include <linux/slab.h> | ||
13 | #include <linux/sysctl.h> | 14 | #include <linux/sysctl.h> |
14 | 15 | ||
15 | #include <net/af_unix.h> | 16 | #include <net/af_unix.h> |
@@ -31,7 +32,7 @@ static struct ctl_path unix_path[] = { | |||
31 | { }, | 32 | { }, |
32 | }; | 33 | }; |
33 | 34 | ||
34 | int unix_sysctl_register(struct net *net) | 35 | int __net_init unix_sysctl_register(struct net *net) |
35 | { | 36 | { |
36 | struct ctl_table *table; | 37 | struct ctl_table *table; |
37 | 38 | ||