Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2229430/?format=api
{ "id": 2229430, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2229430/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260428083332.768693-18-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-18-aalbersh@kernel.org>", "date": "2026-04-28T08:33:23", "name": "[v9,17/22] xfs: remove unwritten extents after preallocations in fsverity metadata", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "70154f58cbfd1bae8818d799becb52377000379a", "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-18-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/2229430/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2229430/checks/", "tags": {}, "headers": { "Return-Path": "\n <SRS0=bIeL=C3=vger.kernel.org=linux-ext4+bounces-16163-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=urZDGhzM;\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=biel=c3=vger.kernel.org=linux-ext4+bounces-16163-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)", "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c0a:e001:db::12fc:5321\"\n 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=urZDGhzM;\n\tdkim-atps=neutral", "gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-16163-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=\"urZDGhzM\"", "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 4g4YwJ3VSSz1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 18:47:28 +1000 (AEST)", "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4g4YwJ33pCz4wLT\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 18:47:28 +1000 (AEST)", "by gandalf.ozlabs.org (Postfix)\n\tid 4g4YwJ2zj8z4wLj; Tue, 28 Apr 2026 18:47:28 +1000 (AEST)", "from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\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 4g4YwD6zNGz4wLT\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 28 Apr 2026 18:47:24 +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 566B130A04BF\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 28 Apr 2026 08:36:28 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 2F4DD3D7D90;\n\tTue, 28 Apr 2026 08:34:46 +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 E1BE23D5673;\n\tTue, 28 Apr 2026 08:34:45 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id 4CC35C2BCB5;\n\tTue, 28 Apr 2026 08:34:43 +0000 (UTC)" ], "ARC-Seal": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1777366048; cv=pass;\n\tb=AHWchmPwe6KquEvz97reHjnSR1ST6Fot7Y7/SqqBE2A8LW7rIDqKA+CAJth/bLOy2PeElC9E1cP2GML/Y22vYUOk2nnmT9rPR8F3evcrtj2x9q3KDBNH22fJcSMP6K2dXKDrPWCfIFL7KpZG+I1lwdI90M7CHQusw+LzezURwd0QjoQL/MVwkdFDFDO6lG2P+wYj3JjhPKfdSDD2TdRe++p357w4UzqLLZ+gcVmEyuQyae9I1KMJIlFPM9rvK2vPR3VcGzPzfGJhQojy7mtYkzqDcXzuAThKdsshnlG/dnMNHT+SKjnnj5aRfCxfmPj54MQfC4nydtLFlWW9mMPGbw==", "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777365286; cv=none;\n b=XeBTBuejOQ0hVPnLrFsKaoMOA6wamowsXzaFDJaGk8ds4RFdiy1u1H9s4sJmDPEPvZT8B+opKmYktXvvW7Gpq3vVblwqK3HB4rPtCZTOHveyS96E9YEECY4bzKikRFbuXTgFoO/ZMmTr00YpYRXps3wbuvh6arqDtN688cZru48=" ], "ARC-Message-Signature": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1777366048; c=relaxed/relaxed;\n\tbh=qCCHYwxJZa/5SOjD2WmE7I8ycEVOggZ75oMnnZ58Shk=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=w4k9I25NFN1I5BHUYdf/7KCJtep03UC5lLc6pQpbknhVwd73tH0My1MKgvbH2ZOVRuFGkWF6JVNYx8p2VYE8SASiAWEI7Je85XjKpa5n2GAnkTnA8sxYws86fBRSzsaW4IRvTuc/J+T12DrBv9fesTgkuZpp7r7Ank8mZevokr7MFT3Szm+Gcwx9r+udwRfTdPoD6YdPnYqwtPQb5IEiAVfLI1Ms4m0Uki0w1sC2VT+HpojfpwTOCXrhx4x0PM4HuPC1F/RYQymgUStXrOAK/+72cTKVYiYd9iQzb6VfRl24TVYkopeBB0uvWItTfBoDAg+s6lthpRzZGUbSXY7gbw==", "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777365286; c=relaxed/simple;\n\tbh=nvo+/jQmBzOVT1hZLKQjDFN1ozBMwJTC50yAygolAgM=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=kymk/pETabNyHBX82hWwK33VWHteOVrnG7+Rylv9r1Wj9YPpTo931ogpYKBbKCxbTw4GfY3XImE2NCcLDYNd0vcXWJZFY4cJ2j+aZmMoQH3+oqn0Cd2gZaQPNxSw2Te8iAd1JRR3i38JdYhIBQz812BHvIMjFGqoBnsfedbSh20=" ], "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=urZDGhzM; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-16163-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=urZDGhzM; 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=1777365285;\n\tbh=nvo+/jQmBzOVT1hZLKQjDFN1ozBMwJTC50yAygolAgM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=urZDGhzMGfrG/uwUDUfeM6fs/a/QVNk3dYPXSRTIym6aApsOZVDAhiCclP0WYtZb6\n\t yL6ZuPAnVELexTtm7a32Nj7Dnih6griNw/PIbW7i+iX+GN+pLXkdfC1MSHLh3/ye3U\n\t YYNydvLMD0JhlbO8kevfxUIKLzte0tjvjWVj4//9TlTfCHr1XYcwIUZ7LAr8C5l6uz\n\t fcCkrU9iU8zcRAnqgSOg3JpweObLv77SO4bGAoqdZ5ncpkGK69sj42anPCKDL/xzij\n\t njeMW68d5pbCOjIqhwyxYrHlDuY6pIfLu7pTMJdQOaGrcuNp3wtGKfnR934+41kHGn\n\t wybtS+p9xMp/w==", "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 17/22] xfs: remove unwritten extents after preallocations\n in fsverity metadata", "Date": "Tue, 28 Apr 2026 10:33:23 +0200", "Message-ID": "<20260428083332.768693-18-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": "XFS preallocates spaces during writes. In normal I/O this space, if\nunused, is removed by truncate. For files with fsverity XFS does not use\ntruncate as fsverity metadata is stored past EOF.\n\nAfter we're done with writing fsverity metadata iterate over extents in\nthat region and remove any unwritten ones. These would be left overs in\nthe holes in the merkle tree and past fsverity descriptor.\n\nReviewed-by: Christoph Hellwig <hch@lst.de>\nReviewed-by: Darrick J. Wong <djwong@kernel.org>\nSigned-off-by: Andrey Albershteyn <aalbersh@kernel.org>\n---\n fs/xfs/xfs_fsverity.c | 69 +++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 69 insertions(+)", "diff": "diff --git a/fs/xfs/xfs_fsverity.c b/fs/xfs/xfs_fsverity.c\nindex a06885291412..298d712b5ba2 100644\n--- a/fs/xfs/xfs_fsverity.c\n+++ b/fs/xfs/xfs_fsverity.c\n@@ -21,6 +21,8 @@\n #include \"xfs_iomap.h\"\n #include \"xfs_error.h\"\n #include \"xfs_health.h\"\n+#include \"xfs_bmap.h\"\n+#include \"xfs_bmap_util.h\"\n #include <linux/fsverity.h>\n #include <linux/iomap.h>\n #include <linux/pagemap.h>\n@@ -171,6 +173,65 @@ xfs_fsverity_delete_metadata(\n \treturn error;\n }\n \n+static int\n+xfs_fsverity_cancel_unwritten(\n+\tstruct xfs_inode\t*ip,\n+\tloff_t\t\t\tstart,\n+\tloff_t\t\t\tend)\n+{\n+\tstruct xfs_mount\t*mp = ip->i_mount;\n+\tstruct xfs_trans\t*tp;\n+\txfs_fileoff_t\t\toffset_fsb = XFS_B_TO_FSB(mp, start);\n+\txfs_fileoff_t\t\tend_fsb = XFS_B_TO_FSB(mp, end);\n+\tstruct xfs_bmbt_irec\timap;\n+\tint\t\t\tnimaps;\n+\tint\t\t\terror = 0;\n+\tint\t\t\tdone;\n+\n+\n+\twhile (offset_fsb < end_fsb) {\n+\t\tnimaps = 1;\n+\n+\t\terror = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, 0, 0,\n+\t\t\t\t0, &tp);\n+\t\tif (error)\n+\t\t\treturn error;\n+\n+\t\txfs_ilock(ip, XFS_ILOCK_EXCL);\n+\t\terror = xfs_bmapi_read(ip, offset_fsb, end_fsb - offset_fsb,\n+\t\t\t\t&imap, &nimaps, 0);\n+\t\tif (error)\n+\t\t\tgoto out_cancel;\n+\n+\t\tif (nimaps == 0)\n+\t\t\tgoto out_cancel;\n+\n+\t\tif (imap.br_state == XFS_EXT_UNWRITTEN) {\n+\t\t\txfs_trans_ijoin(tp, ip, 0);\n+\n+\t\t\terror = xfs_bunmapi(tp, ip, imap.br_startoff,\n+\t\t\t\t\timap.br_blockcount, 0, 1, &done);\n+\t\t\tif (error)\n+\t\t\t\tgoto out_cancel;\n+\n+\t\t\terror = xfs_trans_commit(tp);\n+\t\t\tif (error)\n+\t\t\t\treturn error;\n+\t\t} else {\n+\t\t\txfs_trans_cancel(tp);\n+\t\t}\n+\t\txfs_iunlock(ip, XFS_ILOCK_EXCL);\n+\n+\t\toffset_fsb = imap.br_startoff + imap.br_blockcount;\n+\t}\n+\n+\treturn error;\n+out_cancel:\n+\txfs_trans_cancel(tp);\n+\txfs_iunlock(ip, XFS_ILOCK_EXCL);\n+\treturn error;\n+}\n+\n \n /*\n * Prepare to enable fsverity by clearing old metadata.\n@@ -248,6 +309,14 @@ xfs_fsverity_end_enable(\n \tif (error)\n \t\tgoto out;\n \n+\t/*\n+\t * Remove unwritten extents left by COW preallocations and write\n+\t * preallocation in the merkle tree holes and past descriptor\n+\t */\n+\terror = xfs_fsverity_cancel_unwritten(ip, range_start, LLONG_MAX);\n+\tif (error)\n+\t\tgoto out;\n+\n \t/*\n \t * Proactively drop any delayed allocations in COW fork, the fsverity\n \t * files are read-only\n", "prefixes": [ "v9", "17/22" ] }