diff mbox

[v2,2/2] NFS: Ensure that rpciod does not trigger reclaim writebacks

Message ID 1408747772-37938-2-git-send-email-trond.myklebust@primarydata.com (mailing list archive)
State New, archived
Headers show

Commit Message

Trond Myklebust Aug. 22, 2014, 10:49 p.m. UTC
The same rpciod codepaths that can trigger GFP_KERNEL allocations
are still able to initiate writeback of NFS pages. Avoid this by
adding an explicit test for PF_FSTRANS in nfs_writepage().

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
 fs/nfs/write.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 175d5d073ccf..b87f681c0e84 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -14,6 +14,7 @@ 
 #include <linux/writeback.h>
 #include <linux/swap.h>
 #include <linux/migrate.h>
+#include <linux/sched.h>
 
 #include <linux/sunrpc/clnt.h>
 #include <linux/nfs_fs.h>
@@ -633,9 +634,14 @@  static int nfs_writepage_locked(struct page *page, struct writeback_control *wbc
 
 int nfs_writepage(struct page *page, struct writeback_control *wbc)
 {
-	int ret;
+	int ret = 0;
 
+	if (unlikely(current->flags & PF_FSTRANS)) {
+		redirty_page_for_writepage(wbc, page);
+		goto unlock;
+	}
 	ret = nfs_writepage_locked(page, wbc);
+unlock:
 	unlock_page(page);
 	return ret;
 }