From patchwork Thu Dec 15 14:07:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Hocko X-Patchwork-Id: 9486827 X-Mozilla-Keys: nonjunk Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on sandeen.net X-Spam-Level: X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, RP_MATCHES_RCVD, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 X-Spam-HP: BAYES_00=-1.9,RCVD_IN_DNSWL_HI=-5,RCVD_IN_SORBS_SPAM=0.5, RP_MATCHES_RCVD=-0.1,URIBL_BLOCKED=0.001 X-Original-To: sandeen@sandeen.net Delivered-To: sandeen@sandeen.net Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by sandeen.net (Postfix) with ESMTP id 40E7C87 for ; Thu, 15 Dec 2016 08:09:57 -0600 (CST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755783AbcLOOJ6 (ORCPT ); Thu, 15 Dec 2016 09:09:58 -0500 Received: from mail-wj0-f196.google.com ([209.85.210.196]:33429 "EHLO mail-wj0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752560AbcLOOH7 (ORCPT ); Thu, 15 Dec 2016 09:07:59 -0500 Received: by mail-wj0-f196.google.com with SMTP id kp2so9963861wjc.0; Thu, 15 Dec 2016 06:07:57 -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=ZCm7gJtZF2Y3A85MkhvToM4hLFitVUif8Q9cFUxaLqA=; b=QRhI01+GxOhv43Bzi92s6RLBXMLEp2XhwI6hKhmJsTpAq4amUlk4A2GiCNMLLhBGYO V63TY/BLc/002OdIoYm9ZkY9QQptlFsFX4voRxaAb2FhZ7puKPp4aF+c4maykceGZ3+2 CxhFOUBvakuylNqmo09t0r+HfOb1JmlEq/aV1lBrWNdhmgmFT2owJEeU61QSIZ23Y5k1 GFinNnSFURM9/XEb404HsISaILnNqxr4v6k+df+REI7miYuR7t6iSewaEVdOHY9NqObM 3eWR6+Xu9bGAL/wfdrpCnAtyLlXYnjGDQIYJ4QondhOkw+E+XNxcOo73q1xGM3VHX1Lc 7Adg== X-Gm-Message-State: AKaTC02PCaTs3A0Ho4W7P7MeaBtXsYRRAyiKQnwdq7uJBYRC78O+I8dqE8B4kXv65U8gBQ== X-Received: by 10.194.97.8 with SMTP id dw8mr1641461wjb.84.1481810876456; Thu, 15 Dec 2016 06:07:56 -0800 (PST) Received: from tiehlicka.suse.cz ([213.151.95.130]) by smtp.gmail.com with ESMTPSA id d8sm12646880wmi.21.2016.12.15.06.07.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Dec 2016 06:07:56 -0800 (PST) From: Michal Hocko To: , Cc: Andrew Morton , Dave Chinner , "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/9] jbd2: make the whole kjournald2 kthread NOFS safe Date: Thu, 15 Dec 2016 15:07:13 +0100 Message-Id: <20161215140715.12732-8-mhocko@kernel.org> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161215140715.12732-1-mhocko@kernel.org> References: <20161215140715.12732-1-mhocko@kernel.org> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org 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 --- fs/jbd2/journal.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 8ed971eeab44..6dad8c5d6ddf 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);