From patchwork Fri Aug 22 22:49:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 4767441 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EB077C0338 for ; Fri, 22 Aug 2014 22:49:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3D7CC2013A for ; Fri, 22 Aug 2014 22:49:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 63B6520131 for ; Fri, 22 Aug 2014 22:49:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752344AbaHVWte (ORCPT ); Fri, 22 Aug 2014 18:49:34 -0400 Received: from mail-ie0-f182.google.com ([209.85.223.182]:40019 "EHLO mail-ie0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752314AbaHVWtc (ORCPT ); Fri, 22 Aug 2014 18:49:32 -0400 Received: by mail-ie0-f182.google.com with SMTP id y20so7300857ier.27 for ; Fri, 22 Aug 2014 15:49:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Yp8QRCMH64vki92q5lPQReAf6cbD5HGSfQFh3y2a90k=; b=YeCpx5eJzLyB02/bw0K960DImWQRFMQiPZukHizl/ywvA2pZCf73akHGHLB2cXuq8/ 5433Y4VC/PSwg3j2U4eG1XM9N7HnJg1x1MmpuiGqlhEMbORgmAh/29CnziA9uhzaIEd0 UvCuatMWJD0He26uGbnpGSYIzYd13Ji/xctf9aRf+ovB/R47kLLL5T1i25R04ZcCi9/Q YY+6uPBtdZJddpjiJw5bMABohU/38DrktYg+nE/QjtLHP4n7GUb0VNHszOK4TXY2xLPN OOKMTfnMP3hUcV8SPMpcc3mK/FZzbBEmsTEUnCyEOUfKiATLKDhsUE9kijZ+kDLYQTVt MOaw== X-Gm-Message-State: ALoCoQlbCm1mIKs1tBNMfWc4CXEvrmKtTqyZ15ovnPTKWcvAsfX5xfb739OqH1iOiMoI7nukBztz X-Received: by 10.50.122.99 with SMTP id lr3mr1599256igb.10.1408747772138; Fri, 22 Aug 2014 15:49:32 -0700 (PDT) Received: from leira.trondhjem.org.localdomain (50-108-91-78.adr01.mskg.mi.frontiernet.net. [50.108.91.78]) by mx.google.com with ESMTPSA id f2sm251241igc.1.2014.08.22.15.49.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Aug 2014 15:49:31 -0700 (PDT) From: Trond Myklebust To: Junxiao Bi 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 Message-Id: <1408747772-37938-2-git-send-email-trond.myklebust@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1408747772-37938-1-git-send-email-trond.myklebust@primarydata.com> References: <53F6F772.6020708@oracle.com> <1408747772-37938-1-git-send-email-trond.myklebust@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 #include #include +#include #include #include @@ -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; }