Linux EXT4 FS development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Andrey Albershteyn via Linux-f2fs-devel"
	<linux-f2fs-devel@lists.sourceforge.net>,
	linux-ext4 <linux-ext4@vger.kernel.org>,
	"Eric Biggers" <ebiggers@kernel.org>,
	"Christoph Hellwig" <hch@lst.de>,
	"Carlos Maiolino" <cem@kernel.org>,
	fsverity <fsverity@lists.linux.dev>
Cc: david@fromorbit.com, "Christian Brauner" <brauner@kernel.org>,
	"Andrey Albershteyn" <aalbersh@kernel.org>,
	"Darrick J. Wong" <djwong@kernel.org>,
	dsterba@suse.cz, tytso@mit.edu
Subject: Re: [f2fs-dev] [PATCH v20 23/23] xfs: enable ro-compat fs-verity flag
Date: Wed, 02 Dec 2026 17:17:35 +0000	[thread overview]
Message-ID: <sashiko-outbox-246316@kernel.org> (raw)
In-Reply-To: <20261202165653.767961-24-aalbersh@kernel.org>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] xfs: XFS_SB_FEAT_RO_COMPAT_VERITY enabled when CONFIG_FS_VERITY
  is unset
- [Medium] xfs: missing XFS_SICK_INO_FSVERITY clearing in xchk_inode()
  and repair
--

commit 5ecf493df61beb05b9242fc3c51aecbbc49d52d6
Author: Andrey Albershteyn <aalbersh@kernel.org>

xfs: enable ro-compat fs-verity flag

This commit adds XFS_SB_FEAT_RO_COMPAT_VERITY to XFS_SB_FEAT_RO_COMPAT_ALL
so that filesystems with the fs-verity ro-compat feature flag can be
mounted read-write.

> diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
> index 2cb375bdbd76b..16d6e8931df06 100644
> --- a/fs/xfs/libxfs/xfs_format.h
> +++ b/fs/xfs/libxfs/xfs_format.h
> @@ -378,8 +378,9 @@ xfs_sb_has_compat_feature(
>  #define XFS_SB_FEAT_RO_COMPAT_ALL \
>  		(XFS_SB_FEAT_RO_COMPAT_FINOBT | \
>  		 XFS_SB_FEAT_RO_COMPAT_RMAPBT | \
> -		 XFS_SB_FEAT_RO_COMPAT_REFLINK| \
> -		 XFS_SB_FEAT_RO_COMPAT_INOBTCNT)
> +		 XFS_SB_FEAT_RO_COMPAT_REFLINK | \
> +		 XFS_SB_FEAT_RO_COMPAT_INOBTCNT | \
> +		 XFS_SB_FEAT_RO_COMPAT_VERITY)
>  #define XFS_SB_FEAT_RO_COMPAT_UNKNOWN	~XFS_SB_FEAT_RO_COMPAT_ALL
>  static inline bool
>  xfs_sb_has_ro_compat_feature(

[Severity: High]
As reported by Christoph Hellwig on v18 [1], should
XFS_SB_FEAT_RO_COMPAT_VERITY be excluded from XFS_SB_FEAT_RO_COMPAT_ALL when
CONFIG_FS_VERITY is disabled?

Allowing read-write mounts on a !CONFIG_FS_VERITY kernel lets online scrub
and repair run with fsverity_active() stubbed out to false, and
xrep_dinode_flags() skips clearing XFS_DIFLAG2_VERITY on realtime or zoned
inodes because of its IS_ENABLED(CONFIG_FS_VERITY) guard:

fs/xfs/scrub/inode_repair.c:xrep_dinode_flags() {
	...
	if (IS_ENABLED(CONFIG_FS_VERITY) &&
	    (flags & XFS_DIFLAG_REALTIME) && (flags2 & XFS_DIFLAG2_VERITY) &&
	    (xfs_has_zoned(mp) || mp->m_sb.sb_rextsize > 1)) {
		flags2 &= ~XFS_DIFLAG2_VERITY;
		if (xfs_has_verity(mp) && S_ISREG(mode))
			ri->zap_verity = true;
	}
	...
}

Because xfs_dinode_verify() rejects that flag combination whenever
xfs_has_verity(mp) is true, xrep_dinode_core() logs and commits an inode
buffer that trips the write verifier and shuts down the filesystem.

[Severity: Medium]
Now that XFS_SB_FEAT_RO_COMPAT_VERITY filesystems can be mounted read-write
and repaired online, does inode scrub or repair ever clear
XFS_SICK_INO_FSVERITY?

When xfs_fsverity_get_descriptor() fails (including during
xchk_prepare_iscrub() -> xchk_inode_setup_verity()), it sets
XFS_SICK_INO_FSVERITY on ip->i_sick.  However,
type_to_health_flag[XFS_SCRUB_TYPE_INODE] only maps to XFS_SICK_INO_CORE,
and neither xchk_inode() nor xrep_inode_zap_verity() adds
XFS_SICK_INO_FSVERITY to sc->healthy_mask via xchk_mark_healthy_if_clean().

After xrep_inode_zap_verity() repairs a broken verity inode, the post-repair
xchk_update_health() pass clears XFS_SICK_INO_CORE and XFS_SICK_INO_FORGET
while leaving XFS_SICK_INO_FSVERITY set.  When the repaired inode is later
evicted, xfs_inactive_health() sees XFS_SICK_INO_FSVERITY without
XFS_SICK_INO_FORGET and marks the parent AG sick with XFS_SICK_AG_INODES.

[1] https://lore.kernel.org/r/aums8EgQ8eIoDL_w@infradead.org

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202165653.767961-1-aalbersh@kernel.org?part=23

      reply	other threads:[~2026-12-02 17:17 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 16:56 [PATCH v20 00/23] fs-verity support for XFS with post EOF merkle tree Andrey Albershteyn
2026-12-02 16:56 ` [PATCH v20 01/23] fs: constify inode argument of inode_state_read_once() Andrey Albershteyn
2026-12-02 16:56 ` [PATCH v20 02/23] fs: strip FS_VERITY_FL from FS_IOC_SETFLAGS Andrey Albershteyn
2026-12-02 16:56 ` [PATCH v20 03/23] fs,fsverity: add I_VERITY_BUILDING inode state flag Andrey Albershteyn
2026-12-02 16:56 ` [PATCH v20 04/23] fs,fsverity: reject S_APPEND on fsverity inodes Andrey Albershteyn
2026-12-02 16:56 ` [PATCH v20 05/23] iomap: use fsverity_is_building() to check for fsverity IO Andrey Albershteyn
2026-12-02 17:09   ` sashiko-bot
2026-12-02 16:56 ` [PATCH v20 06/23] btrfs: use I_VERITY_BUILDING instead of private flags Andrey Albershteyn
2026-12-02 16:56 ` [PATCH v20 07/23] ext4: " Andrey Albershteyn
2026-12-02 16:56 ` [PATCH v20 08/23] f2fs: " Andrey Albershteyn
2026-12-02 16:56 ` [PATCH v20 09/23] xfs: introduce fsverity on-disk changes Andrey Albershteyn
2026-12-02 16:56 ` [PATCH v20 10/23] xfs: don't allow to enable DAX on fs-verity sealed inode Andrey Albershteyn
2026-12-02 16:56 ` [PATCH v20 11/23] xfs: disable direct read path for fs-verity files Andrey Albershteyn
2026-12-02 16:56 ` [PATCH v20 12/23] xfs: don't report dio_mem_align and dio_offset_align for fsverity files Andrey Albershteyn
2026-12-02 16:56 ` [PATCH v20 13/23] xfs: handle fsverity I/O in write/read path Andrey Albershteyn
2026-12-02 16:56 ` [PATCH v20 14/23] xfs: use read ioend for fsverity data verification Andrey Albershteyn
2026-12-02 17:15   ` sashiko-bot
2026-12-02 16:56 ` [PATCH v20 15/23] xfs: add XFS_BMAPI_UNWRITTEN to unmap unwritten extents in __xfs_bunmapi() Andrey Albershteyn
2026-12-02 17:09   ` sashiko-bot
2026-12-02 16:56 ` [PATCH v20 16/23] xfs: don't remove written extents past EOF on fsverity inodes Andrey Albershteyn
2026-12-02 16:56 ` [PATCH v20 17/23] xfs: add fs-verity support Andrey Albershteyn
2026-12-02 16:56 ` [PATCH v20 18/23] xfs: initialize fs-verity on file open Andrey Albershteyn
2026-12-02 16:56 ` [PATCH v20 19/23] xfs: add fs-verity ioctls Andrey Albershteyn
2026-12-02 16:56 ` [PATCH v20 20/23] xfs: advertise fs-verity being available on filesystem Andrey Albershteyn
2026-12-02 16:56 ` [PATCH v20 21/23] xfs: check and repair the verity inode flag state Andrey Albershteyn
2026-12-02 16:56 ` [PATCH v20 22/23] xfs: introduce health state for corrupted fsverity metadata Andrey Albershteyn
2026-12-02 17:17   ` [f2fs-dev] " sashiko-bot
2026-12-02 16:56 ` [PATCH v20 23/23] xfs: enable ro-compat fs-verity flag Andrey Albershteyn
2026-12-02 17:17   ` sashiko-bot [this message]

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-246316@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=aalbersh@kernel.org \
    --cc=brauner@kernel.org \
    --cc=cem@kernel.org \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=dsterba@suse.cz \
    --cc=ebiggers@kernel.org \
    --cc=fsverity@lists.linux.dev \
    --cc=hch@lst.de \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tytso@mit.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox