Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1079632rwl; Wed, 5 Apr 2023 11:27:25 -0700 (PDT) X-Google-Smtp-Source: AKy350Y9lr9nXYmkQ7Ek+M1PEobcH67qiWXH+qxSC30cWf6sr6lYYh44u+yEK5i929yfGFsEeMEc X-Received: by 2002:a62:7b92:0:b0:5b4:beb2:2042 with SMTP id w140-20020a627b92000000b005b4beb22042mr6763928pfc.19.1680719245234; Wed, 05 Apr 2023 11:27:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680719245; cv=none; d=google.com; s=arc-20160816; b=ITqCSzIXDsI1EI1SMj3TdxxCZWOCiXuUDAdc1SCVxuxC9rLwHZGa4c4pRd0JWeeRVO 1ASbEfXtP5oxj8nlUpuQe6LQ0M3I2M33eXexsEG5qu0MG8UZ9VOpLkRO7jp1DNf9ySiF CzJYiVl/+TQVw0DxbZZEbGjFSlNw5lskssYPmx01KjqYtOBeQlbpVrcqlJ17r7vh/8f8 jC9cC9RwNpcgfkQlLxWqnxp0wH6qUpWhY8jpgP/woGlJO0P/EXuJPN+O7K8cRxpmmhEQ GiBu9DlnURFNbsLjC0Gt961FfqFTfCeqA584hgW6P+77ovGJs9mF1jdPQmWbjtcQx+U6 Wjxw== 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=nMGdYZVz88iNnPqnJrvWnqcw1Ql+5T1kzULIEIbApDk=; b=gug5hyXsSOJ80QM622cP3Ssk5t1Y36PjrREjcEsBDcrI2j0XdvF3pWFaWKlfgPHbFW JztU45/gD8UfuKvXq4RhVtHfQHL5omn0iXDRG+OBDGf2TAnM/Rm47k77sZpNiaBCi0om M/OfOrgnq+U8ccklND6cFHCvPciQTcG6/uZMe3c0hfjQkp4GK51SY1crG3jbMEaLG0yo fjUs3mIQMYGSoAtjG89diydfTJFUr4q+ADpv8VTKZyIv4M18TPLPdHDG16eU8/upI712 DGhPINL2lYhETWxfdqrdPuqYYg76jYgEr++NsglHE0ivMlpQmv9N8oRsFgm5BG8CvgrK sqnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=REOOWtLg; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s11-20020a63f04b000000b0050bf8a41c8asi5452340pgj.744.2023.04.05.11.26.40; Wed, 05 Apr 2023 11:27:25 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=REOOWtLg; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230263AbjDESQE (ORCPT + 99 others); Wed, 5 Apr 2023 14:16:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbjDESQD (ORCPT ); Wed, 5 Apr 2023 14:16:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0432F659B; Wed, 5 Apr 2023 11:16:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 52AA963D92; Wed, 5 Apr 2023 18:16:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 710CAC433EF; Wed, 5 Apr 2023 18:16:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680718561; bh=wiJeaBlTTUnHN5dRjU986tMd+hpSmAJjFn5myvsg4zA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=REOOWtLgQ9JDh9SSF6xoyg94oSouuHFnpL2v3YnQ3T2oBYSI6IMS8Hy8imtRKtDy1 cU3K/Iy3e/I3Q2+TSdKRafqsRNXapecZukPc1WANLn9sTP01Li50nyZ7qlCS5TCVJ+ 3cW7AZM1K/82Q6rN89XufLRWJRxkvNpgVxn/rDB2tRQwEAn32VY0qtyYqIT5Mhljtf O5whuuDDjSKbQwdJKsF8Nl8Wr8dqY9vgtd1lUYNpjci7tFUD9wHH4/61yvdWJlTH+K DtIew2Dd7HkelryBLbZ5MioiFh7yAV2qMaWKrH/687VXslb1Q2GI4zSjEhOMaWMwe0 NDlFE8RqYVveQ== Date: Wed, 5 Apr 2023 18:16:00 +0000 From: Eric Biggers To: "Darrick J. Wong" Cc: Andrey Albershteyn , dchinner@redhat.com, hch@infradead.org, linux-xfs@vger.kernel.org, fsverity@lists.linux.dev, rpeterso@redhat.com, agruenba@redhat.com, xiang@kernel.org, chao@kernel.org, damien.lemoal@opensource.wdc.com, jth@kernel.org, linux-erofs@lists.ozlabs.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com Subject: Re: [PATCH v2 21/23] xfs: handle merkle tree block size != fs blocksize != PAGE_SIZE Message-ID: References: <20230404145319.2057051-1-aalbersh@redhat.com> <20230404145319.2057051-22-aalbersh@redhat.com> <20230404163602.GC109974@frogsfrogsfrogs> <20230405160221.he76fb5b45dud6du@aalbersh.remote.csb> <20230405163847.GG303486@frogsfrogsfrogs> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230405163847.GG303486@frogsfrogsfrogs> X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS 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 On Wed, Apr 05, 2023 at 09:38:47AM -0700, Darrick J. Wong wrote: > > The merkle tree pages are dropped after verification. When page is > > dropped xfs_buf is marked as verified. If fs-verity wants to > > verify again it will get the same verified buffer. If buffer is > > evicted it won't have verified state. > > > > So, with enough memory pressure buffers will be dropped and need to > > be reverified. > > Please excuse me if this was discussed and rejected long ago, but > perhaps fsverity should try to hang on to the merkle tree pages that > this function returns for as long as possible until reclaim comes for > them? > > With the merkle tree page lifetimes extended, you then don't need to > attach the xfs_buf to page->private, nor does xfs have to extend the > buffer cache to stash XBF_VERITY_CHECKED. Well, all the other filesystems that support fsverity (ext4, f2fs, and btrfs) just cache the Merkle tree pages in the inode's page cache. It's an approach that I know some people aren't a fan of, but it's efficient and it works. We could certainly think about moving to a design where fs/verity/ asks the filesystem to just *read* a Merkle tree block, without adding it to a cache, and then fs/verity/ implements the caching itself. That would require some large changes to each filesystem, though, unless we were to double-cache the Merkle tree blocks which would be inefficient. So it feels like continuing to have the filesystem (not fs/verity/) be responsible for the cache is the best way to allow XFS to do things a bit differently, without regressing the other filesystems. I'm interested in hearing any other proposals, though. - Eric