[PATCH -mmotm 30/30] fix mess up on swap with multi files from same nfs server

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Xiaotian Feng
Date: Tuesday, July 13, 2010 - 3:22 am

From fd03848cadf5719228f617b72039cc8302d892ef Mon Sep 17 00:00:00 2001
From: Xiaotian Feng <dfeng@redhat.com>
Date: Tue, 13 Jul 2010 14:00:02 +0800
Subject: [PATCH 30/30] fix mess up on swap with multi files from same nfs server

xs_swapper() will set xprt->swapper when swapon nfs files, unset xprt->swapper
when swapoff nfs files. This will lead a bug if we swapon multi files from
the same nfs server, they had the same xprt, then the reserved memory could
not be disconnected when we swapoff all files.

Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
---
 include/linux/sunrpc/xprt.h |    4 ++--
 net/sunrpc/xprtsock.c       |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index ba2330d..bc49091 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -171,8 +171,8 @@ struct rpc_xprt {
 	unsigned int		max_reqs;	/* total slots */
 	unsigned long		state;		/* transport state */
 	unsigned char		shutdown   : 1,	/* being shut down */
-				resvport   : 1, /* use a reserved port */
-				swapper    : 1; /* we're swapping over this
+				resvport   : 1;	/* use a reserved port */
+	unsigned int		swapper;	/* we're swapping over this
 						   transport */
 	unsigned int		bind_index;	/* bind function index */
 
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 5c8b918..30bb8ce 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1662,11 +1662,11 @@ int xs_swapper(struct rpc_xprt *xprt, int enable)
 		 */
 		err = sk_adjust_memalloc(1, RPC_RESERVE_PAGES);
 		if (!err) {
-			xprt->swapper = 1;
+			xprt->swapper++;
 			xs_set_memalloc(xprt);
 		}
 	} else if (xprt->swapper) {
-		xprt->swapper = 0;
+		xprt->swapper--;
 		sk_clear_memalloc(transport->inet);
 		sk_adjust_memalloc(-1, -RPC_RESERVE_PAGES);
 	}
-- 
1.7.1.1

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH -mmotm 00/30] [RFC] swap over nfs -v21, Xiaotian Feng, (Tue Jul 13, 3:16 am)
[PATCH -mmotm 02/30] Swap over network documentation, Xiaotian Feng, (Tue Jul 13, 3:17 am)
[PATCH -mmotm 03/30] mm: expose gfp_to_alloc_flags(), Xiaotian Feng, (Tue Jul 13, 3:17 am)
[PATCH -mmotm 04/30] mm: tag reseve pages, Xiaotian Feng, (Tue Jul 13, 3:17 am)
[PATCH -mmotm 06/30] mm: kmem_alloc_estimate(), Xiaotian Feng, (Tue Jul 13, 3:17 am)
[PATCH -mmotm 08/30] mm: emergency pool, Xiaotian Feng, (Tue Jul 13, 3:18 am)
[PATCH -mmotm 09/30] mm: system wide ALLOC_NO_WATERMARK, Xiaotian Feng, (Tue Jul 13, 3:18 am)
[PATCH -mmotm 10/30] mm: __GFP_MEMALLOC, Xiaotian Feng, (Tue Jul 13, 3:18 am)
[PATCH -mmotm 11/30] mm: memory reserve management, Xiaotian Feng, (Tue Jul 13, 3:18 am)
[PATCH -mmotm 13/30] net: packet split receive api, Xiaotian Feng, (Tue Jul 13, 3:19 am)
[PATCH -mmotm 16/30] netvm: INET reserves, Xiaotian Feng, (Tue Jul 13, 3:19 am)
[PATCH -mmotm 18/30] netvm: filter emergency skbs, Xiaotian Feng, (Tue Jul 13, 3:20 am)
[PATCH -mmotm 21/30] netvm: skb processing, Xiaotian Feng, (Tue Jul 13, 3:20 am)
[PATCH -mmotm 26/30] nfs: enable swap on NFS, Xiaotian Feng, (Tue Jul 13, 3:21 am)
[PATCH -mmotm 28/30] build fix for skb_emergency_protocol, Xiaotian Feng, (Tue Jul 13, 3:22 am)
[PATCH -mmotm 30/30] fix mess up on swap with multi files ..., Xiaotian Feng, (Tue Jul 13, 3:22 am)
Re: [PATCH -mmotm 00/30] [RFC] swap over nfs -v21, Américo Wang, (Tue Jul 13, 5:53 am)