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: 10502913 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 D58E160225 for ; Tue, 3 Jul 2018 04:11:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C443B28AF1 for ; Tue, 3 Jul 2018 04:11:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B822228AFF; Tue, 3 Jul 2018 04:11:37 +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=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4388228AF1 for ; Tue, 3 Jul 2018 04:11:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 701496B0005; Tue, 3 Jul 2018 00:11:33 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6D7D86B0006; Tue, 3 Jul 2018 00:11:33 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C6586B0007; Tue, 3 Jul 2018 00:11:33 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f71.google.com (mail-pl0-f71.google.com [209.85.160.71]) by kanga.kvack.org (Postfix) with ESMTP id 0127E6B0005 for ; Tue, 3 Jul 2018 00:11:32 -0400 (EDT) Received: by mail-pl0-f71.google.com with SMTP id q18-v6so488438pll.3 for ; Mon, 02 Jul 2018 21:11:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=wROZXR55v3VHEyiaUL/XcpsIzvoNOBVCIFogMA05AqM=; b=q9AL3MErqYF6Gs/nmUcSrnZBwnBClv+PGLpCkOvYmhBqVmX9Kz32IJvY4q96IjllYO yeaidCEqKKT6upPuCnW2PjC12lIbVFUl1bVD5CcqKGaRjqby+1b4FbsWXMm1qY8DnNc6 ts0fx6i8xw7thN0cmOLug6vm5bP1GooiPPV4xk7lTctEPPijbCQuhp/ovgwz1n5G+hsM eA6vWJpmUoRfb4rDaffU8MsaPHZBbG6DKwW71efn6TwvqKxacEs/fXk3fSXyLVMsutZK Z26P4N+FCAYZmHpuv46HZowmVpLcFEfHAsJt31falyAMCfIHflw2Rgu3NVx1KAP82ak5 9JJw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.132 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com X-Gm-Message-State: APt69E0h7mILnmoG+0O2OCzOwGC2XGKU91NrESZsR481BC3FhP3Ef/PI fMEVPEEow/gkd4/CvLaF+JeY5FLlcmp7y2zsG3tX6JxCJIpuHtssZvYYoOTh6eu5n/DITG0MCU9 5bOUr0oNG6OJPbS84YrAJkkyRYgBwHvmIH/9D8eSdQKFTskSLkRIJCUVW7fiUcGyNIg== X-Received: by 2002:a65:6211:: with SMTP id d17-v6mr24634261pgv.450.1530591092686; Mon, 02 Jul 2018 21:11:32 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKRLayizEyEKEMmQXum9cMCtCsvyjcKJpr20kCt63V2CpUCGS0ew8ODH0LhWEWeginsOQeZ X-Received: by 2002:a65:6211:: with SMTP id d17-v6mr24634221pgv.450.1530591091363; Mon, 02 Jul 2018 21:11:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530591091; cv=none; d=google.com; s=arc-20160816; b=irbt+sPoRc78vXsnc8lXiWrojlXr9dtUwXK1mc29zqJv+5TFhrURbguyGX6UWuZB2S dHcZ8DcwOkaDgjqJDXV83pT5QfHq+mSnUmWv6EKdJNK0vZHIS8vzeAKHmGbThSE2DdNS GvkRdOqzcyrnZH1MNHLPN82/zMbVlE3N2SagKIhibn3XbLVTefB5bIK95WU7zLZSJEFk iqnKYpEjJpJV7VgKMUNryWvhMHzAc91K441g1+nWXgNm+4mDfHE17jAgxRXV/0B6/1/3 C6QEGcrDVb2TzbBZ1ef8Uhug2LsWcbn/G6lXaEUw0tamuvm+KiqXtEQCEvXqJhOdOUXo h0mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=wROZXR55v3VHEyiaUL/XcpsIzvoNOBVCIFogMA05AqM=; b=nDnM2UbwaCm5G6OXP5Dsk9Hdq5Lfc4N1SFUWIMI4RH8vLagt6QBWi4R75cfrLX74XO PYtAqyeprzw/pI7E9NBxJVcNlH1kAglehCHyDbVDPTGuGdi/BBiE7ceT8Vflo44brEOG 4c4soI5MNF5iZaR5HkHtsO8ef25FtjdssaCAeRB94mSXBJSC6XReXNCGIublShUmmZAl nq0uFfzpJ7syxiUV/CJmTxn02K7ccxmV+Ycc4uKr1ZeMNbk6dpcRnEa5RxlA4yVnHBsq 8PXcobZGpRqAcQnRxhoRsO6cysq4kct9rpn2FaC7AVM7UHXpcOM2B5bJIhqtkS8HCGWa m0WQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.132 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com. [115.124.30.132]) by mx.google.com with ESMTPS id u1-v6si188103pgo.114.2018.07.02.21.11.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Jul 2018 21:11:31 -0700 (PDT) Received-SPF: pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.132 as permitted sender) client-ip=115.124.30.132; Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.132 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com 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> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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