diff options
author | Benjamin LaHaise <benjamin.c.lahaise@intel.com> | 2005-12-14 02:22:19 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-01-03 16:10:44 -0500 |
commit | c1cbe4b7ad0bc4b1d98ea708a3fecb7362aa4088 (patch) | |
tree | 04ec26c728645dd1da2474b2b883a532b43811ad /include | |
parent | f1f71e03b17db3b9edb0264a8be7719bd5c35582 (diff) |
[NET]: Avoid atomic xchg() for non-error case
It also looks like there were 2 places where the test on sk_err was
missing from the event wait logic (in sk_stream_wait_connect and
sk_stream_wait_memory), while the rest of the sock_error() users look
to be doing the right thing. This version of the patch fixes those,
and cleans up a few places that were testing ->sk_err directly.
Signed-off-by: Benjamin LaHaise <benjamin.c.lahaise@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/sock.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 982b4ecd187b..0fbae85c6d55 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1166,7 +1166,10 @@ static inline int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) | |||
1166 | 1166 | ||
1167 | static inline int sock_error(struct sock *sk) | 1167 | static inline int sock_error(struct sock *sk) |
1168 | { | 1168 | { |
1169 | int err = xchg(&sk->sk_err, 0); | 1169 | int err; |
1170 | if (likely(!sk->sk_err)) | ||
1171 | return 0; | ||
1172 | err = xchg(&sk->sk_err, 0); | ||
1170 | return -err; | 1173 | return -err; |
1171 | } | 1174 | } |
1172 | 1175 | ||