From patchwork Fri Jan 6 14:11:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Hocko X-Patchwork-Id: 9501087 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 535946021C for ; Fri, 6 Jan 2017 14:15:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A4E4205AD for ; Fri, 6 Jan 2017 14:15:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4EFA0284CC; Fri, 6 Jan 2017 14:15:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9713205AD for ; Fri, 6 Jan 2017 14:15:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755260AbdAFOMj (ORCPT ); Fri, 6 Jan 2017 09:12:39 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33223 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755184AbdAFOLZ (ORCPT ); Fri, 6 Jan 2017 09:11:25 -0500 Received: by mail-wm0-f68.google.com with SMTP id u144so5290654wmu.0; Fri, 06 Jan 2017 06:11:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=anse68usM7wIMIp5lQA9B4XeKkNW5EzFWqLAaVNmYj4=; b=tHnTQf/9J5Jfyf2YNsKYYbTgkLn2fEC1G5WuGurRABsdAe29nqCExsJEMCcA1Wt3fl NB+6ko2jqFVoQq7B2ZrMuUOjX+63rc6X+wFshV8rUGMgqpyfmGPbuXQbdfnCfvytvNu5 dCpWUSSDnrDSZ2GA0l4goLAxw3d/EVVDB2auAiP9Are4GT2Zb6Q057xheWREfETc8NCl Lqk5c9XCcwR2j+7DbdHhfKYt0+COcy67700GhEVynP0ldqerSkAfyqS3bvR4/j0JS692 fYA1UdvFASUIS2ym/KztkNT0GkFmSR8E+WFgfzc/zn3dlqPhFmGhwATp1gOWoh6rF24g hSZg== X-Gm-Message-State: AIkVDXIrpBWX0c9rmd/8AaIStiE1PVH/moQT8Wr2jRWoaNsXO6E4xZX3o5oTzEBtVAUd9A== X-Received: by 10.28.139.74 with SMTP id n71mr4013574wmd.139.1483711882750; Fri, 06 Jan 2017 06:11:22 -0800 (PST) Received: from tiehlicka.suse.cz ([213.151.95.130]) by smtp.gmail.com with ESMTPSA id b15sm3592642wma.5.2017.01.06.06.11.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Jan 2017 06:11:22 -0800 (PST) From: Michal Hocko To: , Cc: Andrew Morton , Dave Chinner , djwong@kernel.org, "Theodore Ts'o" , Chris Mason , David Sterba , Jan Kara , ceph-devel@vger.kernel.org, cluster-devel@redhat.com, linux-nfs@vger.kernel.org, logfs@logfs.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-mtd@lists.infradead.org, reiserfs-devel@vger.kernel.org, linux-ntfs-dev@lists.sourceforge.net, linux-f2fs-devel@lists.sourceforge.net, linux-afs@lists.infradead.org, LKML , Michal Hocko Subject: [PATCH 6/8] jbd2: make the whole kjournald2 kthread NOFS safe Date: Fri, 6 Jan 2017 15:11:05 +0100 Message-Id: <20170106141107.23953-7-mhocko@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170106141107.23953-1-mhocko@kernel.org> References: <20170106141107.23953-1-mhocko@kernel.org> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Michal Hocko kjournald2 is central to the transaction commit processing. As such any potential allocation from this kernel thread has to be GFP_NOFS. Make sure to mark the whole kernel thread GFP_NOFS by the memalloc_nofs_save. Suggested-by: Jan Kara Signed-off-by: Michal Hocko Reviewed-by: Jan Kara --- fs/jbd2/journal.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index a097048ed1a3..3a449150f834 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -206,6 +206,13 @@ static int kjournald2(void *arg) wake_up(&journal->j_wait_done_commit); /* + * Make sure that no allocations from this kernel thread will ever recurse + * to the fs layer because we are responsible for the transaction commit + * and any fs involvement might get stuck waiting for the trasn. commit. + */ + memalloc_nofs_save(); + + /* * And now, wait forever for commit wakeup events. */ write_lock(&journal->j_state_lock);