Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2229441/?format=api
{ "id": 2229441, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2229441/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260428083332.768693-7-aalbersh@kernel.org/", "project": { "id": 8, "url": "http://patchwork.ozlabs.org/api/1.1/projects/8/?format=api", "name": "Linux ext4 filesystem development", "link_name": "linux-ext4", "list_id": "linux-ext4.vger.kernel.org", "list_email": "linux-ext4@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null }, "msgid": "<20260428083332.768693-7-aalbersh@kernel.org>", "date": "2026-04-28T08:33:12", "name": "[v9,06/22] fsverity: hoist pagecache_read from f2fs/ext4 to fsverity", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "7c4a7af0f87f71f4e09f701939957b461c16a7e9", "submitter": { "id": 92821, "url": "http://patchwork.ozlabs.org/api/1.1/people/92821/?format=api", "name": "Andrey Albershteyn", "email": "aalbersh@kernel.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260428083332.768693-7-aalbersh@kernel.org/mbox/", "series": [ { "id": 501796, "url": "http://patchwork.ozlabs.org/api/1.1/series/501796/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=501796", "date": "2026-04-28T08:33:09", "name": "[v9,01/22] fsverity: report validation errors through fserror to fsnotify", "version": 9, "mbox": "http://patchwork.ozlabs.org/series/501796/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2229441/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2229441/checks/", "tags": {}, "headers": { "Return-Path": "\n <SRS0=KVRo=C3=vger.kernel.org=linux-ext4+bounces-16152-patchwork-incoming=ozlabs.org@ozlabs.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-ext4@vger.kernel.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "patchwork-incoming@ozlabs.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=VmZhNNKP;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=kvro=c3=vger.kernel.org=linux-ext4+bounces-16152-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)", "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=172.234.253.10 arc.chain=subspace.kernel.org", "gandalf.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org", "gandalf.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=VmZhNNKP;\n\tdkim-atps=neutral", "gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-16152-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"VmZhNNKP\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201" ], "Received": [ "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4Z4V47jNz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 18:54:34 +1000 (AEST)", "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4g4Z4V3GwDz4wLd\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 18:54:34 +1000 (AEST)", "by gandalf.ozlabs.org (Postfix)\n\tid 4g4Z4V3CVPz4wLh; Tue, 28 Apr 2026 18:54:34 +1000 (AEST)", "from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4g4Z4R0vNzz4wLd\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 28 Apr 2026 18:54:31 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 07E3631AD98B\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 28 Apr 2026 08:34:42 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id A327A3D7D6E;\n\tTue, 28 Apr 2026 08:34:13 +0000 (UTC)", "from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 60B623D75D2;\n\tTue, 28 Apr 2026 08:34:12 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id 5E742C2BCB6;\n\tTue, 28 Apr 2026 08:34:10 +0000 (UTC)" ], "ARC-Seal": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1777366474; cv=pass;\n\tb=o+JQwq8y8JZLb2UT0ttEIDdNnGfHbpNU2QU+SPuiIzsMiEpLVCmlQa2AlWbI2GXrBC/vGhelVERmSGEagpoHvnCOJ48InZd6tj6SsAErWkfrY+VnVT3hcQOyxu2bJEa35ORp9j37plDSPtaR044DtIjTPnJkiFE2NuCDKqfbUSOYDPfLZ73Fdxsg8qYK5xh4GzxB4efrZwbifmoMEETMLMdYeGWCxILAWOM4w2h9JluhBm0SzDugsqI0EheVpIjp6iv8/CBfM7hj1glRK6NEkr5QcpS1kcYha6eYXfNGXnrPoL7MPxJGplYkmFR90L54/VHZqRwqFxGhaXu0boUN0g==", "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777365253; cv=none;\n b=Oq+ZFEzE+eXz39bjqLlwtCJpEk6si0beKerxPxzKsTEYEd+5bJa5Yveml/dc3O0VMaQXsEflJN3Do3UmYs7x6JrGSP1z3wSjLsr2YqFSWrUAW2IXgkAh8tlYRfvDQDtoAHSlsI+CMcEgbRpQa7zi5E0biF1048TaPhnyjg6tReU=" ], "ARC-Message-Signature": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1777366474; c=relaxed/relaxed;\n\tbh=sVTGGPE/qLWPG7zNwh5xf7mxjHPGfB8oH+pkWcFtnJk=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=xB3gkzc/VLcVSl548ZT4RkjP0tgRvZZd4obJaq/tpnf4BMNg4AdXS/jCaBSgO3nECpPH+050GYbJ6a95tXjLZmxR5wHlhCFx8C7rOOTjYtU4ETW+1XZlDS3aGWoe8PlNvPB/NMNEn8rCQivVE7JtM2MMcYUna7XEBcnwqZg/87EyyA5aUQuh9iwd64ldOOkUXQFucKEzLjdZF24AzdFK9GAL5zbx9XE4jezSK8d0/FEBOjj/WMPrPsRHO4NeWfClx31peNipa0Fad1TTLSXm7379J6DOlLoSiyyxOb/l98TZsDfT7im+8Zotn+Rahl6nKU8hD5BFXAt9I0NEEnZPOw==", "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777365253; c=relaxed/simple;\n\tbh=vZWYj+Ga6j52sqD6hIaXvS0sskvDwDhFJnZNiPmdFsM=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=LJuMRrtDLkayh2xVDZJooOoJ2MXTG0/FyZ9kfyJpSdvkUb3R6ujal7285ns8KKGLNbBJHK2l/0Ox5Yuf3rUYeFv074RfQ9OsglC+ndMQGT2bvJH3vQ2lLnFkxFRc+UHSuGxEV/u/1aLbPOoCnH31rZr+/ulngr+UaX3bWciHLnE=" ], "ARC-Authentication-Results": [ "i=2; gandalf.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org;\n dkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=VmZhNNKP; dkim-atps=neutral;\n spf=pass (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-16152-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org", "i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=VmZhNNKP; arc=none smtp.client-ip=10.30.226.201" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1777365252;\n\tbh=vZWYj+Ga6j52sqD6hIaXvS0sskvDwDhFJnZNiPmdFsM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=VmZhNNKP/ulsdWpMk3tAKwNDbkjMDpSvGDgeFpOwGgeiJcyfQFdkpt7V+EEH546lH\n\t SHhLmP2D5DR2zDKK6LdpuQnaBGjd0zHaCZyxsDbOA/lyJkI78+B6UBQrtEUjLtwSTt\n\t uLU1RLtFro4jQKlG+BOdbeLLMC0KS15z27ejnH32+9zbCEQVAwgwcjzXjenDRj7m2o\n\t yTgnWwnazpcqcL5cWXmtXGQXO1mwvys74FL8vNnkFhLAaRYUCS5esau8LfEbPbUC7u\n\t V3ll2Tpp+o/vH8K6ZCt+xlBRH8ZHku46anKD2YQIPFXgqt2icAFgT+stOIsGr3MV5+\n\t iNtzyaJ9R44uQ==", "From": "Andrey Albershteyn <aalbersh@kernel.org>", "To": "linux-xfs@vger.kernel.org,\n\tfsverity@lists.linux.dev,\n\tlinux-fsdevel@vger.kernel.org,\n\tebiggers@kernel.org", "Cc": "Andrey Albershteyn <aalbersh@kernel.org>,\n\thch@lst.de,\n\tlinux-ext4@vger.kernel.org,\n\tlinux-f2fs-devel@lists.sourceforge.net,\n\tlinux-btrfs@vger.kernel.org,\n\tlinux-unionfs@vger.kernel.org,\n\tdjwong@kernel.org", "Subject": "[PATCH v9 06/22] fsverity: hoist pagecache_read from f2fs/ext4 to\n fsverity", "Date": "Tue, 28 Apr 2026 10:33:12 +0200", "Message-ID": "<20260428083332.768693-7-aalbersh@kernel.org>", "X-Mailer": "git-send-email 2.51.2", "In-Reply-To": "<20260428083332.768693-1-aalbersh@kernel.org>", "References": "<20260428083332.768693-1-aalbersh@kernel.org>", "Precedence": "bulk", "X-Mailing-List": "linux-ext4@vger.kernel.org", "List-Id": "<linux-ext4.vger.kernel.org>", "List-Subscribe": "<mailto:linux-ext4+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-ext4+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Spam-Status": "No, score=-1.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,\n\tMAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=disabled\n\tversion=4.0.1", "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org" }, "content": "This is the same function to read from pageache. XFS will also need\nthis, so move this to core fsverity.\n\nNote that f2fs and ext4 functions diverged a bit, as ext4 operated over\nfolios and f2fs operated over pages. The common one will operate over\nfolios.\n\nReviewed-by: Darrick J. Wong <djwong@kernel.org>\nReviewed-by: Christoph Hellwig <hch@lst.de>\nAcked-by: Eric Biggers <ebiggers@kernel.org>\nSigned-off-by: Andrey Albershteyn <aalbersh@kernel.org>\n---\n fs/ext4/verity.c | 32 +++-----------------------------\n fs/f2fs/verity.c | 30 +-----------------------------\n fs/verity/pagecache.c | 33 +++++++++++++++++++++++++++++++++\n include/linux/fsverity.h | 2 ++\n 4 files changed, 39 insertions(+), 58 deletions(-)", "diff": "diff --git a/fs/ext4/verity.c b/fs/ext4/verity.c\nindex 347945ac23a4..ac5c133f5529 100644\n--- a/fs/ext4/verity.c\n+++ b/fs/ext4/verity.c\n@@ -34,32 +34,6 @@ static inline loff_t ext4_verity_metadata_pos(const struct inode *inode)\n \treturn round_up(inode->i_size, 65536);\n }\n \n-/*\n- * Read some verity metadata from the inode. __vfs_read() can't be used because\n- * we need to read beyond i_size.\n- */\n-static int pagecache_read(struct inode *inode, void *buf, size_t count,\n-\t\t\t loff_t pos)\n-{\n-\twhile (count) {\n-\t\tstruct folio *folio;\n-\t\tsize_t n;\n-\n-\t\tfolio = read_mapping_folio(inode->i_mapping, pos >> PAGE_SHIFT,\n-\t\t\t\t\t NULL);\n-\t\tif (IS_ERR(folio))\n-\t\t\treturn PTR_ERR(folio);\n-\n-\t\tn = memcpy_from_file_folio(buf, folio, pos, count);\n-\t\tfolio_put(folio);\n-\n-\t\tbuf += n;\n-\t\tpos += n;\n-\t\tcount -= n;\n-\t}\n-\treturn 0;\n-}\n-\n /*\n * Write some verity metadata to the inode for FS_IOC_ENABLE_VERITY.\n * kernel_write() can't be used because the file descriptor is readonly.\n@@ -311,8 +285,8 @@ static int ext4_get_verity_descriptor_location(struct inode *inode,\n \t\tgoto bad;\n \tdesc_size_pos -= sizeof(desc_size_disk);\n \n-\terr = pagecache_read(inode, &desc_size_disk, sizeof(desc_size_disk),\n-\t\t\t desc_size_pos);\n+\terr = fsverity_pagecache_read(inode, &desc_size_disk,\n+\t\t\t\t sizeof(desc_size_disk), desc_size_pos);\n \tif (err)\n \t\treturn err;\n \tdesc_size = le32_to_cpu(desc_size_disk);\n@@ -352,7 +326,7 @@ static int ext4_get_verity_descriptor(struct inode *inode, void *buf,\n \tif (buf_size) {\n \t\tif (desc_size > buf_size)\n \t\t\treturn -ERANGE;\n-\t\terr = pagecache_read(inode, buf, desc_size, desc_pos);\n+\t\terr = fsverity_pagecache_read(inode, buf, desc_size, desc_pos);\n \t\tif (err)\n \t\t\treturn err;\n \t}\ndiff --git a/fs/f2fs/verity.c b/fs/f2fs/verity.c\nindex b3b3e71604ac..5ea0a9b40443 100644\n--- a/fs/f2fs/verity.c\n+++ b/fs/f2fs/verity.c\n@@ -36,34 +36,6 @@ static inline loff_t f2fs_verity_metadata_pos(const struct inode *inode)\n \treturn round_up(inode->i_size, 65536);\n }\n \n-/*\n- * Read some verity metadata from the inode. __vfs_read() can't be used because\n- * we need to read beyond i_size.\n- */\n-static int pagecache_read(struct inode *inode, void *buf, size_t count,\n-\t\t\t loff_t pos)\n-{\n-\twhile (count) {\n-\t\tsize_t n = min_t(size_t, count,\n-\t\t\t\t PAGE_SIZE - offset_in_page(pos));\n-\t\tstruct page *page;\n-\n-\t\tpage = read_mapping_page(inode->i_mapping, pos >> PAGE_SHIFT,\n-\t\t\t\t\t NULL);\n-\t\tif (IS_ERR(page))\n-\t\t\treturn PTR_ERR(page);\n-\n-\t\tmemcpy_from_page(buf, page, offset_in_page(pos), n);\n-\n-\t\tput_page(page);\n-\n-\t\tbuf += n;\n-\t\tpos += n;\n-\t\tcount -= n;\n-\t}\n-\treturn 0;\n-}\n-\n /*\n * Write some verity metadata to the inode for FS_IOC_ENABLE_VERITY.\n * kernel_write() can't be used because the file descriptor is readonly.\n@@ -248,7 +220,7 @@ static int f2fs_get_verity_descriptor(struct inode *inode, void *buf,\n \tif (buf_size) {\n \t\tif (size > buf_size)\n \t\t\treturn -ERANGE;\n-\t\tres = pagecache_read(inode, buf, size, pos);\n+\t\tres = fsverity_pagecache_read(inode, buf, size, pos);\n \t\tif (res)\n \t\t\treturn res;\n \t}\ndiff --git a/fs/verity/pagecache.c b/fs/verity/pagecache.c\nindex 99f5f53eea98..9d82e6b74ba1 100644\n--- a/fs/verity/pagecache.c\n+++ b/fs/verity/pagecache.c\n@@ -78,3 +78,36 @@ void fsverity_fill_zerohash(struct folio *folio, size_t offset, size_t len,\n \t\t\t\tvi->tree_params.digest_size);\n }\n EXPORT_SYMBOL_GPL(fsverity_fill_zerohash);\n+\n+/**\n+ * fsverity_pagecache_read() - read page and copy data to buffer\n+ * @inode:\tcopy from this inode's address space\n+ * @buf:\tbuffer to copy to\n+ * @count:\tnumber of bytes to copy\n+ * @pos:\tposition of the folio to copy from\n+ *\n+ * Read some verity metadata from the inode. __vfs_read() can't be used because\n+ * we need to read beyond i_size.\n+ */\n+int fsverity_pagecache_read(struct inode *inode, void *buf, size_t count,\n+\t\t\t loff_t pos)\n+{\n+\twhile (count) {\n+\t\tstruct folio *folio;\n+\t\tsize_t n;\n+\n+\t\tfolio = read_mapping_folio(inode->i_mapping, pos >> PAGE_SHIFT,\n+\t\t\t\t\t NULL);\n+\t\tif (IS_ERR(folio))\n+\t\t\treturn PTR_ERR(folio);\n+\n+\t\tn = memcpy_from_file_folio(buf, folio, pos, count);\n+\t\tfolio_put(folio);\n+\n+\t\tbuf += n;\n+\t\tpos += n;\n+\t\tcount -= n;\n+\t}\n+\treturn 0;\n+}\n+EXPORT_SYMBOL_GPL(fsverity_pagecache_read);\ndiff --git a/include/linux/fsverity.h b/include/linux/fsverity.h\nindex 9e7d946676b9..f9433332c274 100644\n--- a/include/linux/fsverity.h\n+++ b/include/linux/fsverity.h\n@@ -328,5 +328,7 @@ void fsverity_cleanup_inode(struct inode *inode);\n struct page *generic_read_merkle_tree_page(struct inode *inode, pgoff_t index);\n void generic_readahead_merkle_tree(struct inode *inode, pgoff_t index,\n \t\t\t\t unsigned long nr_pages);\n+int fsverity_pagecache_read(struct inode *inode, void *buf, size_t count,\n+\t\t\t loff_t pos);\n \n #endif\t/* _LINUX_FSVERITY_H */\n", "prefixes": [ "v9", "06/22" ] }