Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6687453rwb; Wed, 18 Jan 2023 08:11:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXtW5mxQjlELCF4A2toVG2bFL2jCoo/d2Dp5MUdP9SMH0aivoVwHioLV2Rmp2k2d4Ua/uZ6X X-Received: by 2002:a17:906:80cd:b0:86d:b50f:6b00 with SMTP id a13-20020a17090680cd00b0086db50f6b00mr6804393ejx.43.1674058297167; Wed, 18 Jan 2023 08:11:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674058297; cv=none; d=google.com; s=arc-20160816; b=Q5ViyjubI00Yx0blQn95fVkmMD8sBohEQHfP77VHBJeztssWg8UgKbcI6NdNQkHMi6 kVfgU8q3rJTQSAZAUI6QXspTCbog1jZBU/Rqgom03qwY9Kh9/OikeqZKrHEHxRDxXWOb kq2u/L69tiiUopYDJQIJYa+1kSYHujqVbqOXZPVHbWAWqHcjBOSO5zb7zBgtewxjkq1t K5yKGEuS9Wp1vF5kKYeN+htit7xB3VcN8kPBbvUCCV36xl9LqmTyCGX30MdCEMxgHvMw t1tyu4PT2d0z/WIERLznJ0N1IG8blAql3kYWqEiO5Pq0SkLavgdDNsTBwBDrJfdJ1gM2 qNEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=GSOq94AXmVvB2t/Hu5/HVPL9U2Xr3S2Gs4mgbP3Jze4=; b=cxiJuEuIaUNapd4+s1UDVCgAMsl3bA3FLEiZzLtHEdk5YC1tSRMp8bod3G7R7/O0tl 1OJ5BMnxdDX50dwGZw2ev6rbaLMt5bO28/liuEPDkJU2/d18E8JWJQeVMq6FRHZa4KoF eZx/HwoTX92Vrt96+1sOSvjSrrfscaMEa22sNqdMiolFSHVSn75OH/Ss1PXse8+mX27a Pyuofrse1xgxQQEYz4so65ciNGWb+IIo1VpKrTa1cZM8bwgaxmgjiXX7jlQowVBTPu0J Mp3B+YcjChw38i/3bSH3NlNToetk8IaaX5ehh9ye5USmy7YdYdAGOvv54YL+vC0JrjZB 9GGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=H4jFoXQ9; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id by6-20020a0564021b0600b0049553740b71si7105026edb.431.2023.01.18.08.11.12; Wed, 18 Jan 2023 08:11:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=H4jFoXQ9; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231268AbjARQET (ORCPT + 99 others); Wed, 18 Jan 2023 11:04:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229584AbjARQDp (ORCPT ); Wed, 18 Jan 2023 11:03:45 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5DDC13D50; Wed, 18 Jan 2023 08:00:38 -0800 (PST) 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=GSOq94AXmVvB2t/Hu5/HVPL9U2Xr3S2Gs4mgbP3Jze4=; b=H4jFoXQ9JNPPdfRtFstnPmrvPm uWOrVD7S7r2C0I7UGlhUvnbnsIczzMh9ht9Oh0scSjoKcjMxXkXI6boL8jWnYcX5zmHYFU70+t16b dN7B/gIGvyDbv0wwI2uVzsQ7PKSchDHzdh9lT9KlZJC7fZHeDWn1sEm8LHv7KH0wT4jLZ+vMGxy+V H2yYWTjNseX7HXyuJ+iNn6aQyEJudOmctSm+1V2Rja3yR7l2qa3gu8ehNTyGzdEfq4GAEGDydDvmd ShS6JHhXe1t92VTzt3aWfQPXYFs/nr0AgLwyTPmVoSrjd/4HITqMfh19kKAiG5w2cMYxZDRIIVlni FN18xZOA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIArZ-0007eO-4K; Wed, 18 Jan 2023 16:00:33 +0000 Date: Wed, 18 Jan 2023 16:00:33 +0000 From: Matthew Wilcox To: Christoph Hellwig Cc: Andrew Morton , Hugh Dickins , linux-afs@lists.infradead.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, cluster-devel@redhat.com, linux-mm@kvack.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-nilfs@vger.kernel.org Subject: Re: [PATCH 7/9] gfs2: handle a NULL folio in gfs2_jhead_process_page Message-ID: References: <20230118094329.9553-1-hch@lst.de> <20230118094329.9553-8-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230118094329.9553-8-hch@lst.de> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed, Jan 18, 2023 at 10:43:27AM +0100, Christoph Hellwig wrote: > filemap_get_folio can return NULL, so exit early for that case. I'm not sure it can return NULL in this specific case. As I understand this code, we're scanning the journal looking for the log head. We've just submitted the bio to read this page. I suppose memory pressure could theoretically push the page out, but if it does, we're doing the wrong thing by just returning here; we need to retry reading the page. Assuming we're not willing to do the work to add that case, I think I'd rather see the crash in folio_wait_locked() than get data corruption from failing to find the head of the log. > Signed-off-by: Christoph Hellwig > --- > fs/gfs2/lops.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c > index 1902413d5d123e..51d4b610127cdb 100644 > --- a/fs/gfs2/lops.c > +++ b/fs/gfs2/lops.c > @@ -472,6 +472,8 @@ static void gfs2_jhead_process_page(struct gfs2_jdesc *jd, unsigned long index, > struct folio *folio; > > folio = filemap_get_folio(jd->jd_inode->i_mapping, index); > + if (!folio) > + return; > > folio_wait_locked(folio); > if (folio_test_error(folio)) > -- > 2.39.0 >