summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Danilov <nikita@clusterfs.com>2006-09-07 20:09:36 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-10-13 11:50:09 -0700
commit18807ffe4e541639abae40dcd2ebd7a20e9078d6 (patch)
tree5eff76590982383ca6c7cf8d29a0d2edfd2885d8
parentb7a7e34e7e033822ffef7386b1b884edede7f6c5 (diff)
NFS: Fix a potential deadlock in nfs_release_page
nfs_wb_page() waits on request completion and, as a result, is not safe to be called from nfs_release_page() invoked by VM scanner as part of GFP_NOFS allocation. Fix possible deadlock by analyzing gfp mask and refusing to release page if __GFP_FS is not set. Signed-off-by: Nikita Danilov <danilov@gmail.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--fs/nfs/file.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index fade02c15e6e..801cc0f1fa65 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -325,7 +325,13 @@ static void nfs_invalidate_page(struct page *page, unsigned long offset)
static int nfs_release_page(struct page *page, gfp_t gfp)
{
- return !nfs_wb_page(page->mapping->host, page);
+ if (gfp & __GFP_FS)
+ return !nfs_wb_page(page->mapping->host, page);
+ else
+ /*
+ * Avoid deadlock on nfs_wait_on_request().
+ */
+ return 0;
}
struct address_space_operations nfs_file_aops = {