get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2218297/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2218297,
    "url": "http://patchwork.ozlabs.org/api/patches/2218297/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260331212827.2631020-20-aalbersh@kernel.org/",
    "project": {
        "id": 8,
        "url": "http://patchwork.ozlabs.org/api/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,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260331212827.2631020-20-aalbersh@kernel.org>",
    "list_archive_url": null,
    "date": "2026-03-31T21:28:20",
    "name": "[v6,19/22] xfs: check and repair the verity inode flag state",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "d48cad45393a4fdb09a6234ef493d855207af483",
    "submitter": {
        "id": 92821,
        "url": "http://patchwork.ozlabs.org/api/people/92821/?format=api",
        "name": "Andrey Albershteyn",
        "email": "aalbersh@kernel.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260331212827.2631020-20-aalbersh@kernel.org/mbox/",
    "series": [
        {
            "id": 498255,
            "url": "http://patchwork.ozlabs.org/api/series/498255/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=498255",
            "date": "2026-03-31T21:28:01",
            "name": "fs-verity support for XFS with post EOF merkle tree",
            "version": 6,
            "mbox": "http://patchwork.ozlabs.org/series/498255/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2218297/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2218297/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <SRS0=3pYq=B7=vger.kernel.org=linux-ext4+bounces-15566-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=BH0CLVpC;\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=3pyq=b7=vger.kernel.org=linux-ext4+bounces-15566-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)",
            "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c04:e001:36c::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=BH0CLVpC;\n\tdkim-atps=neutral",
            "gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15566-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=\"BH0CLVpC\"",
            "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 4flhQP6XdXz1yCp\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 08:41:33 +1100 (AEDT)",
            "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4flhQP65p1z58dG\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 08:41:33 +1100 (AEDT)",
            "by gandalf.ozlabs.org (Postfix)\n\tid 4flhQP61fHz4wGT; Wed, 01 Apr 2026 08:41:33 +1100 (AEDT)",
            "from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::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 4flhQL2J8cz58dG\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 01 Apr 2026 08:41:30 +1100 (AEDT)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id D2F5330D5068\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 31 Mar 2026 21:31:28 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id D70704779BD;\n\tTue, 31 Mar 2026 21:29:32 +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 9826E45BD60;\n\tTue, 31 Mar 2026 21:29:32 +0000 (UTC)",
            "by smtp.kernel.org (Postfix) with ESMTPSA id DA3EBC2BC9E;\n\tTue, 31 Mar 2026 21:29:29 +0000 (UTC)"
        ],
        "ARC-Seal": [
            "i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1774993293; cv=pass;\n\tb=F7eQsJXAyZh7IggpFHUW4EMMtAeluSOapObxed0NxKNsd2tB/1c1Yl0hmyIFpjzC8s4Y4KbxMgP12pyG7HGxejLuuDltjC4qIb4Sh7YSnVmZoaMUvdR+cYKnAyRtFR/aFxiaeZd5xI6BUvuYG5tJTYFE4Muc6SxVMQzROVRTbi5w4Vn5wOawTwkZ69/UYNdo9zOqTUl9TbzN5uBL5NiWBR89qI9rkoS4hLRqZ30vgxkBWZjUt9//HqitolF4TEi2T+5AXpR40IAPBsU4mosYldIB855bsadb1ec+k4UgubFvXqDIBe9YpKhOkmo4q2uPPnttsMsedwJ/p0umiQyYcw==",
            "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774992572; cv=none;\n b=OJ6hcPmqoY3EDt4SZjiuBu8L3Q+pCiAySGI+ZUfyOL7CrxgY4XQAXIsVDe32Y2ofeNTp2MC68whAuXUeV3rTCuxvA9lTh5u2jHSLoSM6euosm6ekeRLtyFG4FeGOsOIvCCIwa8msFWIdQwTVkxaj6i6GuQR5RwiW5brfwsJSYXA="
        ],
        "ARC-Message-Signature": [
            "i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1774993293; c=relaxed/relaxed;\n\tbh=nr3n6wKVw8z1RqKf0qMNxbYgklAIhJeGEJG0w2GuxFo=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=VCp9M+1JczPC9p0fcyQfaeLfvF1fNmKxr1/5KQvv3Q2BxbRc6QhbqhBqDreXbhhwzb8Svikm8eP4MlNuXcxDg/pgzDjsPQuJugWJVGdeuW0xg7MeYojUsmIq64qiblWIjZsb6bKdSB2YdZ16PP8tYVmns3pk+44aiSWjRiOLE3D6xZOzRKMFGV15dbVsvXK35iM+R/3T/jIhkh8BWMABaa4okhYJL9vGasCpvZt6riWmyjgCF7s8tVch28aXFAwnmxwRVA7EYGNbpOXPJ1qQetfF2m9mrg/4fg5vQzu8xDPU/18sxz9pH9387uQ21PSMb+KnJ7OfU8mhDv6XOGuMpQ==",
            "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774992572; c=relaxed/simple;\n\tbh=FsBOPVJRb/QrQLG6ZBKFxRnn0ugs2nqu0bQPN0vd+/c=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=fJR0c/cqa+kPqV4oTH9kl5NuiqafB7vBV0YdvCBM6GQcmJGg6bOAr1/utlEAJMWPI5pV1FOJN+IpjkTu7p92Oo1mTZHvqWZ1Ez96dzY/nnNLyuNO7CKfffwaW0+bb4WmwZSqZbIHfIUNLVmuDwOI0BvJjQb95wGGm2A3UbRKQBg="
        ],
        "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=BH0CLVpC; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15566-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=BH0CLVpC; 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=1774992572;\n\tbh=FsBOPVJRb/QrQLG6ZBKFxRnn0ugs2nqu0bQPN0vd+/c=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=BH0CLVpCCcDLsOJwUdbEZxMA7EaeItkSTRX652hR0/PzSED0PuSZBdqzQq++udm+p\n\t L1QnBVQyvGP786wDLePJtz2rIfvjaQ0kycTyoe8OKRONx7Atxm1uKQTUGZiRuASoqj\n\t 1fAcE0tqm84kCjTvV/ui9IyA7m0HoRG2FXwYrxfZ7ilOyZiuffPgn3RLYVUC5u+IUV\n\t JVp5SaQ0Vq6tiOKyqZIt6NmA86X9XtatlQReqKqjripdaIz6PF0w2NcSYVvCZ7Ms3l\n\t NGD19krXtvob96VQyrt2R3yEBnME1psXj98FzWkbcuNzOsY9blCruz1NYC6R6GJR8x\n\t hMqVP5+Z3jm3g==",
        "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": "\"Darrick J. Wong\" <djwong@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\tAndrey Albershteyn <aalbersh@kernel.org>",
        "Subject": "[PATCH v6 19/22] xfs: check and repair the verity inode flag state",
        "Date": "Tue, 31 Mar 2026 23:28:20 +0200",
        "Message-ID": "<20260331212827.2631020-20-aalbersh@kernel.org>",
        "X-Mailer": "git-send-email 2.51.2",
        "In-Reply-To": "<20260331212827.2631020-1-aalbersh@kernel.org>",
        "References": "<20260331212827.2631020-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": "From: \"Darrick J. Wong\" <djwong@kernel.org>\n\nIf an inode has the incore verity iflag set, make sure that we can\nactually activate fsverity on that inode.  If activation fails due to\na fsverity metadata validation error, clear the flag.  The usage model\nfor fsverity requires that any program that cares about verity state is\nrequired to call statx/getflags to check that the flag is set after\nopening the file, so clearing the flag will not compromise that model.\n\nSigned-off-by: Darrick J. Wong <djwong@kernel.org>\nReviewed-by: Christoph Hellwig <hch@lst.de>\nSigned-off-by: Andrey Albershteyn <aalbersh@kernel.org>\n---\n fs/xfs/scrub/attr.c         |  7 +++++\n fs/xfs/scrub/common.c       | 53 +++++++++++++++++++++++++++++++++++++\n fs/xfs/scrub/common.h       |  2 ++\n fs/xfs/scrub/inode.c        |  7 +++++\n fs/xfs/scrub/inode_repair.c | 36 +++++++++++++++++++++++++\n 5 files changed, 105 insertions(+)",
    "diff": "diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c\nindex 390ac2e11ee0..daf7962c2374 100644\n--- a/fs/xfs/scrub/attr.c\n+++ b/fs/xfs/scrub/attr.c\n@@ -649,6 +649,13 @@ xchk_xattr(\n \tif (!xfs_inode_hasattr(sc->ip))\n \t\treturn -ENOENT;\n \n+\t/*\n+\t * If this is a verity file that won't activate, we cannot check the\n+\t * merkle tree geometry.\n+\t */\n+\tif (xchk_inode_verity_broken(sc->ip))\n+\t\txchk_set_incomplete(sc);\n+\n \t/* Allocate memory for xattr checking. */\n \terror = xchk_setup_xattr_buf(sc, 0);\n \tif (error == -ENOMEM)\ndiff --git a/fs/xfs/scrub/common.c b/fs/xfs/scrub/common.c\nindex 20e63069088b..6cc6bea9c554 100644\n--- a/fs/xfs/scrub/common.c\n+++ b/fs/xfs/scrub/common.c\n@@ -45,6 +45,8 @@\n #include \"scrub/health.h\"\n #include \"scrub/tempfile.h\"\n \n+#include <linux/fsverity.h>\n+\n /* Common code for the metadata scrubbers. */\n \n /*\n@@ -1743,3 +1745,54 @@ xchk_inode_count_blocks(\n \treturn xfs_bmap_count_blocks(sc->tp, sc->ip, whichfork, nextents,\n \t\t\tcount);\n }\n+\n+/*\n+ * If this inode has S_VERITY set on it, read the verity info. If the reading\n+ * fails with anything other than ENOMEM, the file is corrupt, which we can\n+ * detect later with fsverity_active.\n+ *\n+ * Callers must hold the IOLOCK and must not hold the ILOCK of sc->ip because\n+ * activation reads inode data.\n+ */\n+int\n+xchk_inode_setup_verity(\n+\tstruct xfs_scrub\t*sc)\n+{\n+\tint\t\t\terror;\n+\n+\tif (!fsverity_active(VFS_I(sc->ip)))\n+\t\treturn 0;\n+\n+\terror = fsverity_ensure_verity_info(VFS_I(sc->ip));\n+\tswitch (error) {\n+\tcase 0:\n+\t\t/* fsverity is active */\n+\t\tbreak;\n+\tcase -ENODATA:\n+\tcase -EMSGSIZE:\n+\tcase -EINVAL:\n+\tcase -EFSCORRUPTED:\n+\tcase -EFBIG:\n+\t\t/*\n+\t\t * The nonzero errno codes above are the error codes that can\n+\t\t * be returned from fsverity on metadata validation errors.\n+\t\t */\n+\t\treturn 0;\n+\tdefault:\n+\t\t/* runtime errors */\n+\t\treturn error;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+/*\n+ * Is this a verity file that failed to activate?  Callers must have tried to\n+ * activate fsverity via xchk_inode_setup_verity.\n+ */\n+bool\n+xchk_inode_verity_broken(\n+\tstruct xfs_inode\t*ip)\n+{\n+\treturn fsverity_active(VFS_I(ip)) && !fsverity_get_info(VFS_I(ip));\n+}\ndiff --git a/fs/xfs/scrub/common.h b/fs/xfs/scrub/common.h\nindex f2ecc68538f0..aa16d310bd6d 100644\n--- a/fs/xfs/scrub/common.h\n+++ b/fs/xfs/scrub/common.h\n@@ -264,6 +264,8 @@ int xchk_inode_is_allocated(struct xfs_scrub *sc, xfs_agino_t agino,\n \t\tbool *inuse);\n int xchk_inode_count_blocks(struct xfs_scrub *sc, int whichfork,\n \t\txfs_extnum_t *nextents, xfs_filblks_t *count);\n+int xchk_inode_setup_verity(struct xfs_scrub *sc);\n+bool xchk_inode_verity_broken(struct xfs_inode *ip);\n \n bool xchk_inode_is_dirtree_root(const struct xfs_inode *ip);\n bool xchk_inode_is_sb_rooted(const struct xfs_inode *ip);\ndiff --git a/fs/xfs/scrub/inode.c b/fs/xfs/scrub/inode.c\nindex 948d04dcba2a..8ce6917e22b4 100644\n--- a/fs/xfs/scrub/inode.c\n+++ b/fs/xfs/scrub/inode.c\n@@ -36,6 +36,10 @@ xchk_prepare_iscrub(\n \n \txchk_ilock(sc, XFS_IOLOCK_EXCL);\n \n+\terror = xchk_inode_setup_verity(sc);\n+\tif (error)\n+\t\treturn error;\n+\n \terror = xchk_trans_alloc(sc, 0);\n \tif (error)\n \t\treturn error;\n@@ -833,6 +837,9 @@ xchk_inode(\n \tif (S_ISREG(VFS_I(sc->ip)->i_mode))\n \t\txchk_inode_check_reflink_iflag(sc, sc->ip->i_ino);\n \n+\tif (xchk_inode_verity_broken(sc->ip))\n+\t\txchk_ino_set_corrupt(sc, sc->sm->sm_ino);\n+\n \txchk_inode_check_unlinked(sc);\n \n \txchk_inode_xref(sc, sc->ip->i_ino, &di);\ndiff --git a/fs/xfs/scrub/inode_repair.c b/fs/xfs/scrub/inode_repair.c\nindex 9738b9ce3f2d..3761e3922466 100644\n--- a/fs/xfs/scrub/inode_repair.c\n+++ b/fs/xfs/scrub/inode_repair.c\n@@ -573,6 +573,8 @@ xrep_dinode_flags(\n \t\tdip->di_nrext64_pad = 0;\n \telse if (dip->di_version >= 3)\n \t\tdip->di_v3_pad = 0;\n+\tif (!xfs_has_verity(mp) || !S_ISREG(mode))\n+\t\tflags2 &= ~XFS_DIFLAG2_VERITY;\n \n \tif (flags2 & XFS_DIFLAG2_METADATA) {\n \t\txfs_failaddr_t\tfa;\n@@ -1613,6 +1615,10 @@ xrep_dinode_core(\n \tif (iget_error)\n \t\treturn iget_error;\n \n+\terror = xchk_inode_setup_verity(sc);\n+\tif (error)\n+\t\treturn error;\n+\n \terror = xchk_trans_alloc(sc, 0);\n \tif (error)\n \t\treturn error;\n@@ -2032,6 +2038,27 @@ xrep_inode_unlinked(\n \treturn 0;\n }\n \n+/*\n+ * If this file is a fsverity file, xchk_prepare_iscrub or xrep_dinode_core\n+ * should have activated it.  If it's still not active, then there's something\n+ * wrong with the verity descriptor and we should turn it off.\n+ */\n+STATIC int\n+xrep_inode_verity(\n+\tstruct xfs_scrub\t*sc)\n+{\n+\tstruct inode\t\t*inode = VFS_I(sc->ip);\n+\n+\tif (xchk_inode_verity_broken(sc->ip)) {\n+\t\tsc->ip->i_diflags2 &= ~XFS_DIFLAG2_VERITY;\n+\t\tinode->i_flags &= ~S_VERITY;\n+\n+\t\txfs_trans_log_inode(sc->tp, sc->ip, XFS_ILOG_CORE);\n+\t}\n+\n+\treturn 0;\n+}\n+\n /* Repair an inode's fields. */\n int\n xrep_inode(\n@@ -2081,6 +2108,15 @@ xrep_inode(\n \t\t\treturn error;\n \t}\n \n+\t/*\n+\t * Disable fsverity if it cannot be activated.  Activation failure\n+\t * prohibits the file from being opened, so there cannot be another\n+\t * program with an open fd to what it thinks is a verity file.\n+\t */\n+\terror = xrep_inode_verity(sc);\n+\tif (error)\n+\t\treturn error;\n+\n \t/* Reconnect incore unlinked list */\n \terror = xrep_inode_unlinked(sc);\n \tif (error)\n",
    "prefixes": [
        "v6",
        "19/22"
    ]
}