Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6716731rwb; Wed, 18 Jan 2023 08:31:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXvnNWb5JdYAddgPivzxTMoppbP94NeJeWC2WVs6hdtmToqXVwS8k5DVMVxX81NvvQVjqnFb X-Received: by 2002:a17:902:c408:b0:194:6afa:ca with SMTP id k8-20020a170902c40800b001946afa00camr11342847plk.56.1674059493299; Wed, 18 Jan 2023 08:31:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674059493; cv=none; d=google.com; s=arc-20160816; b=Y5AWPmSZQQq2Pw7OAsoXsm/UC/D8kLtGd7cLt04Trpm6UqlS7M+NAx70ljCgIcL485 PBGepVJ2TdVUeO2xL5Zuu7C2feed3SusABcSxqeBOk8b1dNbuz5K088hbBpxRf35kerq xxxpDTjkrAKmVSLuL7WmJEhVekFK/Xc1jmjwkBbsBFx//uPgk/3vI4fle8yKgDwXCXf3 Z70Mk6e2/DTwJ4tnk4YVaG0QeNtoXBObb2NVscLFxbfkbIruMbjuHQShH4RRKT0w872k GeYk+igfhDzVNuJFcTay0TwlPkQn84bcVqTO032JrIngbDvRmFbSAnVeoTnJA/dfmSdo j9Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=H4gPDbXgRwcEu9eRFB58g+gXi6AVjus+QHhs3v57+Uw=; b=OL0ujKvBgc7YoB4KZfEAJ4DMpvs9c7tGCffkgWulvuDMwSFHQciZbjtwNm9b37yNSw IuDkSdsIJYbR8/uK5XEMQMWhanUf5ZBhv6euYxccSi1/7Hszfe/5bEzqUFGJdgg0ShOE iF3rw+CuLEYkh5gqr7dmBAnGJnIos/M6pmznbCTGGj8mu01ntZv+IL58Hn3YSwiaJctX YJysn8YndPTs3vD9zHAuGChfpbPUo3mge0sap/OODN2wHBNT/nBJLOGP+2uXcsD7s75D WCZH3NUxEFdFBiITc9O5JyJinkbW13kREHpgVZKA6xRCPvVaAOCt9BU07MhAjb6GeGyN 5ggQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RFkJUvHM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m14-20020a170902db0e00b001945f74ad98si20849588plx.549.2023.01.18.08.31.18; Wed, 18 Jan 2023 08:31:33 -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=@redhat.com header.s=mimecast20190719 header.b=RFkJUvHM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229880AbjARQ11 (ORCPT + 99 others); Wed, 18 Jan 2023 11:27:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230381AbjARQ0z (ORCPT ); Wed, 18 Jan 2023 11:26:55 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 983694F357 for ; Wed, 18 Jan 2023 08:24:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674059087; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=H4gPDbXgRwcEu9eRFB58g+gXi6AVjus+QHhs3v57+Uw=; b=RFkJUvHMDuQchLyf9vNPTzTv5UVaDoKxoCJTZppqYkj2s0qUgfuEbJgv/ZmdNdzwzNxnjq 50CrQEY3XS1c8udSuRqqwLtRa32gFxHXyTokNsJvGaBpJQz/OVV8QgGk6gmZ2SVpbtCg9q ZPTWjWKOkbiYib+xcsWK7fLLSQIxJRQ= Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-639-1L4tweVZPW6QctVm6TtldQ-1; Wed, 18 Jan 2023 11:24:45 -0500 X-MC-Unique: 1L4tweVZPW6QctVm6TtldQ-1 Received: by mail-pf1-f199.google.com with SMTP id l7-20020a62be07000000b0058de3976793so1333767pff.18 for ; Wed, 18 Jan 2023 08:24:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=H4gPDbXgRwcEu9eRFB58g+gXi6AVjus+QHhs3v57+Uw=; b=fUWU8EjmLpRe81nLvuI7mLszytk7NC2J9FH/XJayqLxJvWKaBjgDuOQPFRuYTIfc8G brCgn/Wc1iQBKm0w9zeR3wNFbw1Iru+LPNCQXw9fuQ1JM3K4D12N4HLJh3616t0v02HV 4h3t0ipFtVeCbH3pPPV7qa1n2006yE1B+Yk9OXK9uTbU7DWuOxsEI3GEw4F2ArQjqTX4 xr9JvOWZNSb2SMCL1R1FaZtTXafNlbpd+G2xlr1MiuIOzr2TIDRsKBmZ5xV1LcSoOmgH Qab0pO3OuVaU3SdOpVRspMMGD8dGedOS0nqy1yNPzKOKxNgofh1pPlO1W33V2FeS5Zdb aFLg== X-Gm-Message-State: AFqh2kqDADMSeUNPek1AVMSOyKk+qgkn13sQMw/CzXsnpprUOtcf1DLf cvcSpNN7xkw8xmGC8N+P5dK084EqTuVG1Pa90otBzdNGiJZ3uCtHm3hwvZgjhRgRcHwPVkDEhdo Inaeu8Ab755QwOP2u/tjN09my3FO7Ab+8iUNF6Q== X-Received: by 2002:a63:5849:0:b0:478:eb77:b104 with SMTP id i9-20020a635849000000b00478eb77b104mr618312pgm.236.1674059084726; Wed, 18 Jan 2023 08:24:44 -0800 (PST) X-Received: by 2002:a63:5849:0:b0:478:eb77:b104 with SMTP id i9-20020a635849000000b00478eb77b104mr618307pgm.236.1674059084379; Wed, 18 Jan 2023 08:24:44 -0800 (PST) MIME-Version: 1.0 References: <20230118094329.9553-1-hch@lst.de> <20230118094329.9553-8-hch@lst.de> In-Reply-To: From: Andreas Gruenbacher Date: Wed, 18 Jan 2023 17:24:32 +0100 Message-ID: Subject: Re: [Cluster-devel] [PATCH 7/9] gfs2: handle a NULL folio in gfs2_jhead_process_page To: Matthew Wilcox Cc: Christoph Hellwig , linux-xfs@vger.kernel.org, linux-nilfs@vger.kernel.org, Hugh Dickins , cluster-devel@redhat.com, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Andrew Morton , linux-ext4@vger.kernel.org, linux-afs@lists.infradead.org, linux-btrfs@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 [Christoph's email ended up in my spam folder; I hope that was a one-time-only occurrence.] On Wed, Jan 18, 2023 at 5:00 PM Matthew Wilcox wrote: > 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; We're actually still holding a reference to the folio from the find_or_create_page() in gfs2_find_jhead() here, so we know that memory pressure can't push the page out and filemap_get_folio() won't return NULL. > > > > folio_wait_locked(folio); > > if (folio_test_error(folio)) > > -- > > 2.39.0 > > > Thanks, Andreas