From: Mel Gorman <mgorman@suse.de>
Subject: [PATCH] nfs: Convert nfs_mark_request_dirty() to use page_file_mapping()
Patch-mainline: Not yet
References: bnc#677738

nfs_mark_request_dirty() uses page->mapping directly. If the page is a
PageSwapCache page, it triggers as oops as the mapping must be retrieved
from the swap info instead. This patch uses page_file_mapping() thus
preventing the oops.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Reviewed-by: NeilBrown <neilb@suse.de>
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
---
 fs/nfs/write.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Index: linux-2.6.37-openSUSE-11.4/fs/nfs/write.c
===================================================================
--- linux-2.6.37-openSUSE-11.4.orig/fs/nfs/write.c
+++ linux-2.6.37-openSUSE-11.4/fs/nfs/write.c
@@ -432,7 +432,8 @@ static void
 nfs_mark_request_dirty(struct nfs_page *req)
 {
 	__set_page_dirty_nobuffers(req->wb_page);
-	__mark_inode_dirty(req->wb_page->mapping->host, I_DIRTY_DATASYNC);
+	__mark_inode_dirty(page_file_mapping(req->wb_page)->host,
+							I_DIRTY_DATASYNC);
 }
 
 #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
