Browse Source

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>
Jeff Layton 10 years ago
parent
commit
264d1df3b3
1 changed files with 3 additions and 0 deletions
  1. 3 0
      net/sunrpc/xprtsock.c

+ 3 - 0
net/sunrpc/xprtsock.c

@@ -827,6 +827,9 @@ static void xs_reset_transport(struct sock_xprt *transport)
 	if (sk == NULL)
 	if (sk == NULL)
 		return;
 		return;
 
 
+	if (atomic_read(&transport->xprt.swapper))
+		sk_clear_memalloc(sk);
+
 	write_lock_bh(&sk->sk_callback_lock);
 	write_lock_bh(&sk->sk_callback_lock);
 	transport->inet = NULL;
 	transport->inet = NULL;
 	transport->sock = NULL;
 	transport->sock = NULL;