summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJeff Layton <jlayton@poochiereds.net>2015-06-03 16:14:27 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2015-06-10 18:26:22 -0400
commit264d1df3b34804a7d440d77771020f616a573528 (patch)
tree56ff34b2f126117802326271f773f39a4a9b725d /net
parent8e2281330f9930bccf77cf04027ec60b6cc0fb34 (diff)
downloadlinux-264d1df3b34804a7d440d77771020f616a573528.tar.gz
linux-264d1df3b34804a7d440d77771020f616a573528.tar.bz2
linux-264d1df3b34804a7d440d77771020f616a573528.zip
sunrpc: if we're closing down a socket, clear memalloc on it first
We currently increment the memalloc_socks counter if we have a xprt that is associated with a swapfile. That socket can be replaced however during a reconnect event, and the memalloc_socks counter is never decremented if that occurs. When tearing down a xprt socket, check to see if the xprt is set up for swapping and sk_clear_memalloc before releasing the socket if so. Acked-by: Mel Gorman <mgorman@suse.de> Signed-off-by: Jeff Layton <jeff.layton@primarydata.com> Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/xprtsock.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 6538e6fbb7ba..31b856a2935c 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -827,6 +827,9 @@ static void xs_reset_transport(struct sock_xprt *transport)
if (sk == NULL)
return;
+ if (atomic_read(&transport->xprt.swapper))
+ sk_clear_memalloc(sk);
+
write_lock_bh(&sk->sk_callback_lock);
transport->inet = NULL;
transport->sock = NULL;