Message ID | 55C8DF6B.9080509@akamai.com |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
On Mon, 2015-08-10 at 13:29 -0400, Jason Baron wrote: > > + > > > > > > > > > > thanks. better? > > --- a/include/net/sock.h > +++ b/include/net/sock.h > @@ -798,8 +798,10 @@ static inline int sk_stream_min_wspace(const struct > sock *sk) > > static inline int sk_stream_wspace(const struct sock *sk) > { > - if (sk->sk_effective_sndbuf) > - return sk->sk_effective_sndbuf - sk->sk_wmem_queued; > + int effective_sndbuf = sk->sk_effective_sndbuf; > + > + if (effective_sndbuf) > + return effective_sndbuf - sk->sk_wmem_queued; > > return sk->sk_sndbuf - sk->sk_wmem_queued; > } > > You need to use instead : int effective_sndbuf = READ_ONCE(sk->sk_effective_sndbuf); -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
--- a/include/net/sock.h +++ b/include/net/sock.h @@ -798,8 +798,10 @@ static inline int sk_stream_min_wspace(const struct sock *sk) static inline int sk_stream_wspace(const struct sock *sk) { - if (sk->sk_effective_sndbuf) - return sk->sk_effective_sndbuf - sk->sk_wmem_queued; + int effective_sndbuf = sk->sk_effective_sndbuf; + + if (effective_sndbuf) + return effective_sndbuf - sk->sk_wmem_queued; return sk->sk_sndbuf - sk->sk_wmem_queued;