From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86C20C433FE for ; Tue, 8 Dec 2020 02:42:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E5BD823433 for ; Tue, 8 Dec 2020 02:42:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E5BD823433 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 595F88D0006; Mon, 7 Dec 2020 21:42:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 51E8D8D0001; Mon, 7 Dec 2020 21:42:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3EA048D0006; Mon, 7 Dec 2020 21:42:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0209.hostedemail.com [216.40.44.209]) by kanga.kvack.org (Postfix) with ESMTP id 221E38D0001 for ; Mon, 7 Dec 2020 21:42:12 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E3EFC362C for ; Tue, 8 Dec 2020 02:42:11 +0000 (UTC) X-FDA: 77568565662.13.line61_2f0154e273e3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id C5E2818140B60 for ; Tue, 8 Dec 2020 02:42:11 +0000 (UTC) X-HE-Tag: line61_2f0154e273e3 X-Filterd-Recvd-Size: 2809 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Tue, 8 Dec 2020 02:42:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=lxhPd96G94u8hhUO8dm3oxiKcUEqLHrJKJGAgEVgEFI=; b=KBfNGlZOfeCKT1AQZmqamolqPx SGAm2hc2A1w0bhK6VmVaLe28sKjp9KrQoh6+DJyc/JuS1iuWl2ml7pZRyZaZMAX6v7J06a9eiPx02 vnRWzChkIoDZXOM68PJ7VxmwA533CuN5QDjw6oucAOPSQjBqKl5+aXq53Oy4ff9YcWB952AynH1CV 6YvZPFdBMF4jL0cqO4B64Gx25hlnMEdnuB3JvG995QuV4C1CS4dR/C5tg+P6RusnMHF5dnn4VmOfu 0EHFcS/QZosYqKsE3UxwwQnJpNyOhInF9kGxH4Md9DwQ5afLS1JktknImbGk+NhHr2JvjE8rebrPI lFWz32tw==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmSww-0002s6-PN; Tue, 08 Dec 2020 02:41:58 +0000 Date: Tue, 8 Dec 2020 02:41:58 +0000 From: Matthew Wilcox To: Yafang Shao Cc: darrick.wong@oracle.com, david@fromorbit.com, hch@infradead.org, mhocko@kernel.org, akpm@linux-foundation.org, dhowells@redhat.com, jlayton@redhat.com, linux-fsdevel@vger.kernel.org, linux-cachefs@redhat.com, linux-xfs@vger.kernel.org, linux-mm@kvack.org, Christoph Hellwig Subject: Re: [PATCH v10 4/4] xfs: use current->journal_info to avoid transaction reservation recursion Message-ID: <20201208024158.GF7338@casper.infradead.org> References: <20201208021543.76501-1-laoar.shao@gmail.com> <20201208021543.76501-5-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201208021543.76501-5-laoar.shao@gmail.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: On Tue, Dec 08, 2020 at 10:15:43AM +0800, Yafang Shao wrote: > - /* > - * Given that we do not allow direct reclaim to call us, we should > - * never be called in a recursive filesystem reclaim context. > - */ > - if (WARN_ON_ONCE(current->flags & PF_MEMALLOC_NOFS)) > - goto redirty; > - > /* > * Is this page beyond the end of the file? > * > diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c > index 2371187b7615..28db93d0da97 100644 > --- a/fs/xfs/xfs_aops.c > +++ b/fs/xfs/xfs_aops.c > @@ -568,6 +568,16 @@ xfs_vm_writepage( > { > struct xfs_writepage_ctx wpc = { }; > > + /* > + * Given that we do not allow direct reclaim to call us, we should > + * never be called while in a filesystem transaction. > + */ > + if (xfs_trans_context_active()) { > + redirty_page_for_writepage(wbc, page); > + unlock_page(page); > + return 0; > + } Dave specifically asked for this one to WARN too.