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: 735702 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vcL2r5JLFz9sNS for ; Tue, 7 Mar 2017 00:18:44 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="L8q1YvTz"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=IrHRLQBzs0MoFeBiqL4A43O94/LV3Gmen1t7LAuF9eU=; b=L8q1YvTzTLG54ub3/55+9jAINp Czn9dy6jboS5YCueL2XT3/wyuwyuxnLv05cI+FHLPOyo6+xQsZJ/+Nr+cj+dQzkhyMKeVQBA6sR6y KKVPUtISG9qx2YoSb36xola3RIT2p3ON+AN7TSF2OG8k2jlChgYpCwfH7MsS657BbJ46JxZJlIqpY G7nqEFZcSoR3ZoWcBtJviwjXSi5qeVnf3sAlE5hu47wPn67VOL+50ehvLj80N+gYCfRHQccvwgMkH wuT/zByiVIV8TonBqLSjYkTmjZE43RlZuG/zjfC1WU2iLDOpa76pC0kgjPJPi57B2GI2PWKlxymPB pq3HnAjQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cksX7-0002tV-C9; Mon, 06 Mar 2017 13:18:37 +0000 Received: from mail-wm0-f67.google.com ([74.125.82.67]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cksTQ-0007oz-MF; Mon, 06 Mar 2017 13:14:50 +0000 Received: by mail-wm0-f67.google.com with SMTP id n11so13688024wma.0; Mon, 06 Mar 2017 05:14:28 -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=S8iq2k8gmv73Hq9YjtsZ3PuE7xghX9hkkF/SQgGt9QR9ZkGWY26cvf56rrC+AQUQds 5p/PiPaqCbM4c99FoqjmvUpVuCZPpBvCblX4zwL8uHdu2vAf8aJu/lQ437VRcBOsk94N VvSdrnmOWerBp+ID8RQm++DjndKrpG26BsRrnVGCiQ0mC4pSNff/u2WF+WNlDG9auyeB Gtl+0wdV06cHDHGs40xzoN0qcEsKMSGjG59mWIbQELrN90GfgglQYJhpN1CitfH0giAe mkUnmGefgnw9vTCwEnDClFK1YKlOuqgeIELOdvG7TrGh56Xc4MUmD1OCuYQhqZwSSDBN kwAg== X-Gm-Message-State: AMke39ksgd/xsJts72TW0sjGTiQTNQLSg9UEwB2YsjH2CRW21O36QB9CKjZ2FQjiPWk4cQ== 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 , 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170306_051448_878308_B6C2D830 X-CRM114-Status: GOOD ( 10.41 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.67 listed in wl.mailspike.net] 0.5 RCVD_IN_SORBS_SPAM RBL: SORBS: sender is a spam source [74.125.82.67 listed in dnsbl.sorbs.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [74.125.82.67 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (mstsxfx[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-xfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Theodore Ts'o , LKML , reiserfs-devel@vger.kernel.org, Chris Mason , linux-ntfs-dev@lists.sourceforge.net, djwong@kernel.org, Dave Chinner , David Sterba , logfs@logfs.org, cluster-devel@redhat.com, linux-mm@kvack.org, Michal Hocko , linux-mtd@lists.infradead.org, Jan Kara , ceph-devel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-afs@lists.infradead.org, linux-btrfs@vger.kernel.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.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 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);