All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <trond.myklebust@primarydata.com>
To: Junxiao Bi <junxiao.bi@oracle.com>
Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH v2 2/2] NFS: Ensure that rpciod does not trigger reclaim writebacks
Date: Fri, 22 Aug 2014 18:49:32 -0400	[thread overview]
Message-ID: <1408747772-37938-2-git-send-email-trond.myklebust@primarydata.com> (raw)
In-Reply-To: <1408747772-37938-1-git-send-email-trond.myklebust@primarydata.com>

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 --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;
 }
-- 
1.9.3


  reply	other threads:[~2014-08-22 22:49 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-22  7:55 rpciod deadlock issue Junxiao Bi
     [not found] ` <53F6F772.6020708-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2014-08-22 22:49   ` [PATCH v2 1/2] SUNRPC: Fix memory reclaim deadlocks in rpciod Trond Myklebust
2014-08-22 22:49     ` Trond Myklebust
2014-08-22 22:49     ` Trond Myklebust [this message]
     [not found]     ` <1408747772-37938-1-git-send-email-trond.myklebust-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>
2014-08-25  5:34       ` Junxiao Bi
2014-08-25  5:34         ` Junxiao Bi
2014-08-25  6:48       ` NeilBrown
2014-08-25  6:48         ` NeilBrown
     [not found]         ` <20140825164852.50723141-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2014-08-26  5:43           ` Junxiao Bi
2014-08-26  5:43             ` Junxiao Bi
2014-08-26  6:21             ` NeilBrown
2014-08-26  6:49               ` Junxiao Bi
2014-08-26  7:04                 ` NeilBrown
     [not found]                   ` <20140826170410.20560764-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2014-08-26  7:23                     ` Junxiao Bi
2014-08-26  7:23                       ` Junxiao Bi
2014-08-26 10:53           ` Mel Gorman
2014-08-26 10:53             ` Mel Gorman
2014-08-26 12:58             ` Trond Myklebust
2014-08-26 13:26               ` Mel Gorman
     [not found]                 ` <20140826132624.GU17696-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2014-08-26 23:19                   ` Johannes Weiner
2014-08-26 23:19                     ` Johannes Weiner
     [not found]                     ` <20140826231938.GA13889-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2014-08-26 23:51                       ` Trond Myklebust
2014-08-26 23:51                         ` Trond Myklebust
     [not found]                         ` <CAHQdGtRPsVFVfph5OcsZk_+WYPPJ-MpE2myZfXAb3jq6fuM4zw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-08-27  0:00                           ` Trond Myklebust
2014-08-27  0:00                             ` Trond Myklebust
2014-08-27 15:36                             ` Mel Gorman
     [not found]                               ` <20140827153644.GF12374-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2014-08-27 16:15                                 ` Trond Myklebust
2014-08-27 16:15                                   ` Trond Myklebust
2014-08-28  8:30                                   ` Mel Gorman
     [not found]                                     ` <20140828083053.GJ12374-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2014-08-28  8:49                                       ` Junxiao Bi
2014-08-28  8:49                                         ` Junxiao Bi
2014-08-28  9:25                                         ` Mel Gorman
2014-09-04 13:54                                 ` Michal Hocko
2014-09-04 13:54                                   ` Michal Hocko
2014-09-09  2:33                                   ` NeilBrown
2014-09-10 13:48                                     ` Michal Hocko
     [not found]                                       ` <20140910134842.GG25219-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2014-09-10 23:57                                         ` NeilBrown
2014-09-10 23:57                                           ` NeilBrown
     [not found]                                           ` <20140911095743.1ed87519-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2014-09-11  8:50                                             ` Michal Hocko
2014-09-11  8:50                                               ` Michal Hocko
     [not found]                                               ` <20140911085046.GC22042-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2014-09-11 10:53                                                 ` NeilBrown
2014-09-11 10:53                                                   ` NeilBrown
2014-08-27  1:43                       ` NeilBrown
2014-08-27  1:43                         ` NeilBrown
2014-08-25  6:05   ` rpciod deadlock issue NeilBrown
2014-08-25  6:05     ` NeilBrown
     [not found]     ` <20140825160501.433b3e9e-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2014-08-25  6:15       ` NeilBrown
2014-08-25  6:15         ` NeilBrown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1408747772-37938-2-git-send-email-trond.myklebust@primarydata.com \
    --to=trond.myklebust@primarydata.com \
    --cc=junxiao.bi@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.