From patchwork Mon Mar 6 13:14:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Hocko X-Patchwork-Id: 9606101 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 2C45B6046A for ; Mon, 6 Mar 2017 13:46:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1997B2723E for ; Mon, 6 Mar 2017 13:46:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C02128418; Mon, 6 Mar 2017 13:46:20 +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 7C7912723E for ; Mon, 6 Mar 2017 13:46:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932113AbdCFNqP (ORCPT ); Mon, 6 Mar 2017 08:46:15 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:34537 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932090AbdCFNqH (ORCPT ); Mon, 6 Mar 2017 08:46:07 -0500 Received: by mail-wm0-f68.google.com with SMTP id u132so5803015wmg.1; Mon, 06 Mar 2017 05:46:05 -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=Tt1VCI36LoV70uXOS6ngRZeKavYn05e8K+VNvU7PWzI=; b=Mkm9QAmwKYTot4rxr1D3OGFxlLRKDc1EK7j/byQ1MmMFuEdfOrNmkUzq+DoI4MsATw Y9CemOuwofeu6Zc8bippUWY6SEukg++sqOmq4hegYreds1pdPK5yr34Oocxq4cPl7z6k BsHAcdrfsx13rOsE57AzJqDCIl0UNDmEDB+X77kUdU9aRcR/CgFlYWSRinMwXJ44o4KR z9twFkV1kWMkvzg4mWP2T761czohvge38ve4CvBBQtX1vrLaJlprm6hKQrK/A4Dl5jF7 D0bU5ESp8wQQDK2GTNEHHstOs5OQteoqHONjYykJ1mYDUNYcFSX80ciYcOekajdxm9MP z32A== X-Gm-Message-State: AMke39m9rS2YiCkRZ8AicgPk3iz+LaYz1dx4P4MoFY4SJPt/+VUJIwevC6Uin5Viz9wZzA== X-Received: by 10.28.17.208 with SMTP id 199mr13429153wmr.9.1488806067615; Mon, 06 Mar 2017 05:14:27 -0800 (PST) Received: from tiehlicka.suse.cz (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id d6sm14829593wmd.6.2017.03.06.05.14.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Mar 2017 05:14:27 -0800 (PST) From: Michal Hocko To: Andrew Morton , Cc: , 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 7/7] jbd2: make the whole kjournald2 kthread NOFS safe Date: Mon, 6 Mar 2017 14:14:08 +0100 Message-Id: <20170306131408.9828-8-mhocko@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170306131408.9828-1-mhocko@kernel.org> References: <20170306131408.9828-1-mhocko@kernel.org> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@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 Reviewed-by: Jan Kara Signed-off-by: Michal Hocko --- fs/jbd2/journal.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index a1a359bfcc9c..78433ce1db40 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -43,6 +43,7 @@ #include #include #include +#include #define CREATE_TRACE_POINTS #include @@ -206,6 +207,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);