From: sashiko-bot@kernel.org
To: "Andrey Albershteyn" <aalbersh@kernel.org>,
ebiggers@kernel.org, hch@lst.de,
"Carlos Maiolino" <cem@kernel.org>,
fsverity@lists.linux.dev
Cc: david@fromorbit.com, "Darrick J. Wong" <djwong@kernel.org>
Subject: Re: [PATCH v18 14/15] xfs: introduce health state for corrupted fsverity metadata
Date: Mon, 02 Nov 2026 15:16:07 +0000 [thread overview]
Message-ID: <sashiko-outbox-193646@kernel.org> (raw)
In-Reply-To: <20261102144147.2393369-15-aalbersh@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] xfs: XFS_SICK_INO_FSVERITY is never cleared by online scrub or repair
--
commit 82a3ec6a24449be06212877f0d87b35ebb6ba704
Author: Andrey Albershteyn <aalbersh@kernel.org>
xfs: introduce health state for corrupted fsverity metadata
This commit adds the XFS_SICK_INO_FSVERITY inode health flag (and its bulkstat
counterpart XFS_BS_SICK_FSVERITY) and marks the inode sick in
xfs_fsverity_get_descriptor() when fsverity descriptor validation fails.
> diff --git a/fs/xfs/libxfs/xfs_health.h b/fs/xfs/libxfs/xfs_health.h
> index 1d45cf5789e86..932b447190da7 100644
> --- a/fs/xfs/libxfs/xfs_health.h
> +++ b/fs/xfs/libxfs/xfs_health.h
> @@ -104,6 +104,7 @@ struct xfs_rtgroup;
> /* Don't propagate sick status to ag health summary during inactivation */
> #define XFS_SICK_INO_FORGET (1 << 12)
> #define XFS_SICK_INO_DIRTREE (1 << 13) /* directory tree structure */
> +#define XFS_SICK_INO_FSVERITY (1 << 14) /* fsverity metadata */
>
> /* Primary evidence of health problems in a given group. */
> #define XFS_SICK_FS_PRIMARY (XFS_SICK_FS_COUNTERS | \
> @@ -140,7 +141,8 @@ struct xfs_rtgroup;
> XFS_SICK_INO_XATTR | \
> XFS_SICK_INO_SYMLINK | \
> XFS_SICK_INO_PARENT | \
> - XFS_SICK_INO_DIRTREE)
> + XFS_SICK_INO_DIRTREE | \
> + XFS_SICK_INO_FSVERITY)
>
> #define XFS_SICK_INO_ZAPPED (XFS_SICK_INO_BMBTD_ZAPPED | \
> XFS_SICK_INO_BMBTA_ZAPPED | \
> diff --git a/fs/xfs/xfs_fsverity.c b/fs/xfs/xfs_fsverity.c
> index 441251b360731..9b83a0735dc04 100644
> --- a/fs/xfs/xfs_fsverity.c
> +++ b/fs/xfs/xfs_fsverity.c
> @@ -89,13 +89,17 @@ xfs_fsverity_get_descriptor(
> if (error)
> return error;
>
> - if (is_empty)
> + if (is_empty) {
> + xfs_inode_mark_sick(XFS_I(inode), XFS_SICK_INO_FSVERITY);
> return -ENODATA;
> + }
[Severity: Medium]
Once xfs_fsverity_get_descriptor() sets XFS_SICK_INO_FSVERITY on an inode, how
is this sickness flag cleared when online scrub or repair runs?
When an inode has corrupted fsverity metadata, opening the file or running
online scrub/repair (XFS_SCRUB_TYPE_INODE) invokes:
xchk_prepare_iscrub() / xrep_dinode_core()
xchk_inode_setup_verity()
fsverity_ensure_verity_info()
fsverity_get_descriptor()
xfs_fsverity_get_descriptor()
xfs_inode_mark_sick(XFS_I(inode), XFS_SICK_INO_FSVERITY)
In fs/xfs/scrub/health.c, type_to_health_flag maps XFS_SCRUB_TYPE_INODE only
to XFS_SICK_INO_CORE:
[XFS_SCRUB_TYPE_INODE] = { XHG_INO, XFS_SICK_INO_CORE },
During online repair, xchk_inode() sees xchk_inode_verity_broken(sc->ip) and
marks XFS_SICK_INO_CORE | XFS_SICK_INO_FORGET corrupt. Then
xrep_inode_verity() repairs the inode by clearing XFS_DIFLAG2_VERITY and
S_VERITY:
fs/xfs/scrub/inode_repair.c:xrep_inode_verity() {
if (xchk_inode_verity_broken(sc->ip)) {
sc->ip->i_diflags2 &= ~XFS_DIFLAG2_VERITY;
inode_set_flags(inode, 0, S_VERITY);
xfs_trans_log_inode(sc->tp, sc->ip, XFS_ILOG_CORE);
}
}
When xfs_scrub_metadata() re-runs xchk_inode() to verify the repair and calls
xchk_update_health(), xfs_inode_mark_healthy(sc->ip, mask) is called with
mask = XFS_SICK_INO_CORE | XFS_SICK_INO_FORGET, because neither xchk_inode()
nor xrep_inode_verity() adds XFS_SICK_INO_FSVERITY to sc->sick_mask or
sc->healthy_mask (and xfs_fsverity_delete_metadata(),
xfs_fsverity_reset_inode(), and xfs_fsverity_end_enable() do not clear it
either).
As a result, xfs_inode_mark_healthy() clears XFS_SICK_INO_CORE and
XFS_SICK_INO_FORGET while leaving XFS_SICK_INO_FSVERITY set in ip->i_sick.
Does this leave the repaired inode permanently sick in memory (preventing
xfs_reclaim_igrab() from reclaiming it and continuing to report
XFS_BS_SICK_FSVERITY in xfs_bulkstat_health()), and cause
xfs_inactive_health() to falsely mark the AG sick with XFS_SICK_AG_INODES when
the repaired inode is eventually inactivated because XFS_SICK_INO_FORGET was
cleared?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261102144147.2393369-1-aalbersh@kernel.org?part=14
next prev parent reply other threads:[~2026-11-02 15:16 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 14:41 [PATCH v18 00/15] fs-verity support for XFS with post EOF merkle tree Andrey Albershteyn
2026-11-02 14:41 ` [PATCH v18 01/15] xfs: introduce fsverity on-disk changes Andrey Albershteyn
2026-11-02 15:08 ` sashiko-bot
2026-11-02 14:41 ` [PATCH v18 02/15] xfs: don't allow to enable DAX on fs-verity sealed inode Andrey Albershteyn
2026-11-02 14:41 ` [PATCH v18 03/15] xfs: disable direct read path for fs-verity files Andrey Albershteyn
2026-11-02 14:41 ` [PATCH v18 04/15] xfs: don't report dio_mem_align and dio_offset_align for fsverity files Andrey Albershteyn
2026-11-03 9:23 ` Christoph Hellwig
2026-11-02 14:41 ` [PATCH v18 05/15] xfs: handle fsverity I/O in write/read path Andrey Albershteyn
2026-11-02 15:13 ` sashiko-bot
2026-11-03 9:37 ` Christoph Hellwig
2026-11-03 13:55 ` Andrey Albershteyn
2026-11-03 14:53 ` Christoph Hellwig
2026-11-03 15:26 ` Andrey Albershteyn
2026-11-03 22:03 ` Eric Biggers
2026-11-02 14:41 ` [PATCH v18 06/15] xfs: use read ioend for fsverity data verification Andrey Albershteyn
2026-11-02 14:57 ` sashiko-bot
2026-11-03 9:39 ` Christoph Hellwig
2026-11-02 14:41 ` [PATCH v18 07/15] xfs: add XFS_BMAPI_UNWRITTEN to unmap unwritten extents in __xfs_bunmapi() Andrey Albershteyn
2026-11-02 15:02 ` sashiko-bot
2026-11-03 9:41 ` Christoph Hellwig
2026-11-03 14:31 ` Andrey Albershteyn
2026-11-03 14:39 ` Christoph Hellwig
2026-11-03 14:45 ` Andrey Albershteyn
2026-11-03 14:49 ` Christoph Hellwig
2026-11-03 15:17 ` Andrey Albershteyn
2026-11-02 14:41 ` [PATCH v18 08/15] xfs: don't remove written extents past EOF on fsverity inodes Andrey Albershteyn
2026-11-02 15:11 ` sashiko-bot
2026-11-03 9:42 ` Christoph Hellwig
2026-11-02 14:41 ` [PATCH v18 09/15] xfs: add fs-verity support Andrey Albershteyn
2026-11-02 15:34 ` sashiko-bot
2026-11-03 18:23 ` Eric Biggers
2026-11-02 14:41 ` [PATCH v18 10/15] xfs: initialize fs-verity on file open Andrey Albershteyn
2026-11-02 14:41 ` [PATCH v18 11/15] xfs: add fs-verity ioctls Andrey Albershteyn
2026-11-02 15:24 ` sashiko-bot
2026-11-02 14:41 ` [PATCH v18 12/15] xfs: advertise fs-verity being available on filesystem Andrey Albershteyn
2026-11-02 14:41 ` [PATCH v18 13/15] xfs: check and repair the verity inode flag state Andrey Albershteyn
2026-11-02 15:28 ` sashiko-bot
2026-11-02 14:41 ` [PATCH v18 14/15] xfs: introduce health state for corrupted fsverity metadata Andrey Albershteyn
2026-11-02 15:16 ` sashiko-bot [this message]
2026-11-02 14:41 ` [PATCH v18 15/15] xfs: enable ro-compat fs-verity flag Andrey Albershteyn
2026-11-02 15:35 ` sashiko-bot
2026-11-03 9:44 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-193646@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=aalbersh@kernel.org \
--cc=cem@kernel.org \
--cc=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=ebiggers@kernel.org \
--cc=fsverity@lists.linux.dev \
--cc=hch@lst.de \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.