qubes-linux-kernel/patches.suse/SoN-32-fix-kernel-bug-with-multiple-swapfiles
2011-04-19 22:09:59 +02:00

46 lines
1.8 KiB
Plaintext

From: Xiaotian Feng <dfeng@redhat.com>
Subject: fix mess up on swap with multi files from same nfs server
Patch-mainline: Not yet
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
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
---
Index: linux-2.6.35-master/include/linux/sunrpc/xprt.h
===================================================================
--- linux-2.6.35-master.orig/include/linux/sunrpc/xprt.h
+++ linux-2.6.35-master/include/linux/sunrpc/xprt.h
@@ -172,8 +172,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 */
Index: linux-2.6.35-master/net/sunrpc/xprtsock.c
===================================================================
--- linux-2.6.35-master.orig/net/sunrpc/xprtsock.c
+++ linux-2.6.35-master/net/sunrpc/xprtsock.c
@@ -1665,11 +1665,11 @@ int xs_swapper(struct rpc_xprt *xprt, in
*/
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);
}