summaryrefslogtreecommitdiffstats
path: root/net/sctp
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-06-17 19:05:41 -0700
committerDavid S. Miller <davem@davemloft.net>2009-06-18 00:29:12 -0700
commit31e6d363abcd0d05766c82f1a9c905a4c974a199 (patch)
treef2b5c46354d95f91e743ae748b8add0de8bffd17 /net/sctp
parentd3b238a03efd6d644ff93c8b10a1d38a596f2e34 (diff)
downloadlinux-31e6d363abcd0d05766c82f1a9c905a4c974a199.tar.gz
linux-31e6d363abcd0d05766c82f1a9c905a4c974a199.tar.bz2
linux-31e6d363abcd0d05766c82f1a9c905a4c974a199.zip
net: correct off-by-one write allocations reports
commit 2b85a34e911bf483c27cfdd124aeb1605145dc80 (net: No more expensive sock_hold()/sock_put() on each tx) changed initial sk_wmem_alloc value. We need to take into account this offset when reporting sk_wmem_alloc to user, in PROC_FS files or various ioctls (SIOCOUTQ/TIOCOUTQ) Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/socket.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 0f01e5d8a24f..35ba035970a2 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -130,7 +130,7 @@ static inline int sctp_wspace(struct sctp_association *asoc)
if (asoc->ep->sndbuf_policy)
amt = asoc->sndbuf_used;
else
- amt = atomic_read(&asoc->base.sk->sk_wmem_alloc);
+ amt = sk_wmem_alloc_get(asoc->base.sk);
if (amt >= asoc->base.sk->sk_sndbuf) {
if (asoc->base.sk->sk_userlocks & SOCK_SNDBUF_LOCK)
@@ -6523,7 +6523,7 @@ static int sctp_writeable(struct sock *sk)
{
int amt = 0;
- amt = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc);
+ amt = sk->sk_sndbuf - sk_wmem_alloc_get(sk);
if (amt < 0)
amt = 0;
return amt;