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: 9476249 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 F2AF760571 for ; Thu, 15 Dec 2016 14:11:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2DA028778 for ; Thu, 15 Dec 2016 14:11:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C69FF28787; Thu, 15 Dec 2016 14:11:32 +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 7D16A28778 for ; Thu, 15 Dec 2016 14:11:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758148AbcLOOJs (ORCPT ); Thu, 15 Dec 2016 09:09:48 -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-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 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 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);