[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#589294: Crashes / traces after copying large files over NFS



Package: linux-2.6
Version: 2.6.32-15
Severity: important


This bug in present in all 2.6.32.x, 33.x and 34.x kernels.

It is a regression in NFS code. When copying a large file (larger than
the amount of available physical memory) to an NFS-mounted filesystem,
swapper and rpciod on the client complain about page allocation failures
and then kswapd goes into a deadlock, resulting in a system-wide crash.

https://bugzilla.kernel.org/show_bug.cgi?id=16056

The following patch fixes it:

dcafd9eb464f5a87512f28c133386773a596261
Author: Trond Myklebust <Trond.Myklebust@netapp.com>
Date:   Wed Jul 14 16:51:48 2010 -0400

    NFS: Don't let kswapd call nfs_wb_page()
    
    kswapd sets the GFP_KERNEL allocation flags, but is still liable to cause
    the system to lock up if it has to wait too long for an RPC call etc to
    succeed.
    
    Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 8d965bd..9af489f 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -491,8 +491,11 @@ static int nfs_release_page(struct page *page, gfp_t gfp)
 {
 	dfprintk(PAGECACHE, "NFS: release_page(%p)\n", page);
 
-	/* Only do I/O if gfp is a superset of GFP_KERNEL */
-	if ((gfp & GFP_KERNEL) == GFP_KERNEL)
+	/* Only do I/O if gfp is a superset of GFP_KERNEL and if
+	 * we're not kswapd or some other memory allocator.
+	 */
+	if ((gfp & GFP_KERNEL) == GFP_KERNEL
+	    && !(current->flags & PF_MEMALLOC))
 		nfs_wb_page(page->mapping->host, page);
 	/* If PagePrivate() is set, then the page is not freeable */
 	if (PagePrivate(page))




-- 
Leszek "Tygrys" Urbanski, SCSA, SCNA
 "Unix-to-Unix Copy Program;" said PDP-1. "You will never find a more
  wretched hive of bugs and flamers. We must be cautious." -- DECWARS
     http://cygnus.moo.pl/ -- Cygnus High Altitude Balloon



Reply to: