NFS: Prevent another deadlock in nfs_release_page()
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 19 Mar 2010 17:55:17 +0000 (13:55 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 1 Apr 2010 22:58:29 +0000 (15:58 -0700)
commit d812e575822a2b7ab1a7cadae2571505ec6ec2bd upstream.

We should not attempt to free the page if __GFP_FS is not set. Otherwise we
can deadlock as per

  http://bugzilla.kernel.org/show_bug.cgi?id=15578

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/nfs/file.c

index 393d40fd7eb9d8fd5dd5d784fc94b741d94e3912..61b3bf503ee157d8243259d41e3d7e13765b27f8 100644 (file)
@@ -486,7 +486,8 @@ static int nfs_release_page(struct page *page, gfp_t gfp)
 {
        dfprintk(PAGECACHE, "NFS: release_page(%p)\n", page);
 
-       if (gfp & __GFP_WAIT)
+       /* Only do I/O if gfp is a superset of GFP_KERNEL */
+       if ((gfp & GFP_KERNEL) == GFP_KERNEL)
                nfs_wb_page(page->mapping->host, page);
        /* If PagePrivate() is set, then the page is not freeable */
        if (PagePrivate(page))