From patchwork Tue Jul 3 04:11:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 10502919 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 A51AB60225 for ; Tue, 3 Jul 2018 04:12:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 957C61FFE6 for ; Tue, 3 Jul 2018 04:12:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 876F128495; Tue, 3 Jul 2018 04:12:02 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable 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 2F3BE1FFE6 for ; Tue, 3 Jul 2018 04:12:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753844AbeGCELk (ORCPT ); Tue, 3 Jul 2018 00:11:40 -0400 Received: from out30-131.freemail.mail.aliyun.com ([115.124.30.131]:44246 "EHLO out30-131.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751760AbeGCELj (ORCPT ); Tue, 3 Jul 2018 00:11:39 -0400 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R121e4; CH=green; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01e04400; MF=yang.shi@linux.alibaba.com; NM=1; PH=DS; RN=12; SR=0; TI=SMTPD_---0T3scjyw_1530591079; Received: from e19h19392.et15sqa.tbsite.net(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0T3scjyw_1530591079) by smtp.aliyun-inc.com(127.0.0.1); Tue, 03 Jul 2018 12:11:27 +0800 From: Yang Shi To: mgorman@techsingularity.net, tytso@mit.edu, adilger.kernel@dilger.ca, darrick.wong@oracle.com, dchinner@redhat.com, akpm@linux-foundation.org Cc: yang.shi@linux.alibaba.com, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] fs: xfs: use BUG_ON if writepage call comes from direct reclaim Date: Tue, 3 Jul 2018 12:11:19 +0800 Message-Id: <1530591079-33813-2-git-send-email-yang.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1530591079-33813-1-git-send-email-yang.shi@linux.alibaba.com> References: <1530591079-33813-1-git-send-email-yang.shi@linux.alibaba.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP direct reclaim doesn't write out filesystem page, only kswapd could do this. So, if it is called from direct relaim, it is definitely a bug. And, Mel Gorman mentioned "Ultimately, this will be a BUG_ON." in commit 94054fa3fca1fd78db02cb3d68d5627120f0a1d4 ("xfs: warn if direct reclaim tries to writeback pages"), It has been many years since that commit, so it should be safe to elevate WARN_ON to BUG_ON now. Cc: Mel Gorman Cc: Darrick J. Wong Cc: Dave Chinner Signed-off-by: Yang Shi --- fs/xfs/xfs_aops.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 8eb3ba3..7efc2d2 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -1080,11 +1080,9 @@ static inline int xfs_bio_add_buffer(struct bio *bio, struct buffer_head *bh) * allow reclaim from kswapd as the stack usage there is relatively low. * * This should never happen except in the case of a VM regression so - * warn about it. + * BUG about it. */ - if (WARN_ON_ONCE((current->flags & (PF_MEMALLOC|PF_KSWAPD)) == - PF_MEMALLOC)) - goto redirty; + BUG_ON((current->flags & (PF_MEMALLOC|PF_KSWAPD)) == PF_MEMALLOC); /* * Given that we do not allow direct reclaim to call us, we should