From: Jeff Layton Date: Tue, 25 Aug 2015 18:28:09 +0000 (-0600) Subject: sunrpc: if we're closing down a socket, clear memalloc on it first X-Git-Tag: v4.1.12-92~278^2^2~59 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=86171c2529eb51497d06620015d269ae55f39e81;p=users%2Fjedix%2Flinux-maple.git sunrpc: if we're closing down a socket, clear memalloc on it first [ Upstream commit 264d1df3b34804a7d440d77771020f616a573528 ] 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 Signed-off-by: Jeff Layton Reviewed-by: Chuck Lever Signed-off-by: Trond Myklebust --- diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 3f34dbcbec6a5..cb928ae4e8f44 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;