public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Andrey Albershteyn <aalbersh@redhat.com>
Cc: fsverity@lists.linux.dev, linux-xfs@vger.kernel.org,
	ebiggers@kernel.org, linux-fsdevel@vger.kernel.org,
	aalbersh@kernel.org, david@fromorbit.com, hch@lst.de
Subject: Re: [PATCH v2 21/22] xfs: add fsverity traces
Date: Mon, 12 Jan 2026 15:07:25 -0800	[thread overview]
Message-ID: <20260112230725.GS15551@frogsfrogsfrogs> (raw)
In-Reply-To: <xvaenghd6d7rd5gnfbfm7zmp5dd4uqa2wchdxcfpxpp2cevp7i@a27fi4opexrk>

On Mon, Jan 12, 2026 at 03:52:20PM +0100, Andrey Albershteyn wrote:
> Even though fsverity has traces, debugging issues with varying block
> sizes could be a bit less transparent without read/write traces.
> 
> Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
> ---
>  fs/xfs/xfs_fsverity.c |  8 ++++++++
>  fs/xfs/xfs_trace.h    | 46 ++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 54 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/xfs/xfs_fsverity.c b/fs/xfs/xfs_fsverity.c
> index f53a404578..06eac2561b 100644
> --- a/fs/xfs/xfs_fsverity.c
> +++ b/fs/xfs/xfs_fsverity.c
> @@ -102,6 +102,8 @@
>  	uint32_t		blocksize = i_blocksize(VFS_I(ip));
>  	xfs_fileoff_t		last_block;
>  
> +	trace_xfs_fsverity_get_descriptor(ip);
> +
>  	ASSERT(inode->i_flags & S_VERITY);
>  	error = xfs_bmap_last_extent(NULL, ip, XFS_DATA_FORK, &rec, &is_empty);
>  	if (error)
> @@ -330,6 +332,8 @@
>  	pgoff_t			offset =
>  			index | (XFS_FSVERITY_REGION_START >> PAGE_SHIFT);
>  
> +	trace_xfs_fsverity_read_merkle(XFS_I(inode), offset, PAGE_SIZE);
> +
>  	folio = __filemap_get_folio(inode->i_mapping, offset, FGP_ACCESSED, 0);
>  	if (IS_ERR(folio) || !folio_test_uptodate(folio)) {
>  		DEFINE_READAHEAD(ractl, NULL, NULL, inode->i_mapping, offset);
> @@ -358,6 +362,8 @@
>  	struct xfs_inode	*ip = XFS_I(inode);
>  	loff_t			position = pos | XFS_FSVERITY_REGION_START;
>  
> +	trace_xfs_fsverity_write_merkle(XFS_I(inode), pos, size);
> +
>  	if (position + size > inode->i_sb->s_maxbytes)
>  		return -EFBIG;
>  
> @@ -370,6 +376,8 @@
>  	loff_t			pos,
>  	size_t			len)
>  {
> +	trace_xfs_fsverity_file_corrupt(XFS_I(inode), pos, len);
> +
>  	xfs_inode_mark_sick(XFS_I(inode), XFS_SICK_INO_DATA);
>  }
>  
> diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
> index f70afbf3cb..1ce4e10b6b 100644
> --- a/fs/xfs/xfs_trace.h
> +++ b/fs/xfs/xfs_trace.h
> @@ -5906,6 +5906,52 @@
>  DEFINE_FREEBLOCKS_RESV_EVENT(xfs_freecounter_reserved);
>  DEFINE_FREEBLOCKS_RESV_EVENT(xfs_freecounter_enospc);
>  
> +TRACE_EVENT(xfs_fsverity_get_descriptor,
> +	TP_PROTO(struct xfs_inode *ip),
> +	TP_ARGS(ip),
> +	TP_STRUCT__entry(
> +		__field(dev_t, dev)
> +		__field(xfs_ino_t, ino)
> +	),
> +	TP_fast_assign(
> +		__entry->dev = VFS_I(ip)->i_sb->s_dev;
> +		__entry->ino = ip->i_ino;
> +	),
> +	TP_printk("dev %d:%d ino 0x%llx",
> +		  MAJOR(__entry->dev), MINOR(__entry->dev),
> +		  __entry->ino)
> +);
> +
> +DECLARE_EVENT_CLASS(xfs_fsverity_class,
> +	TP_PROTO(struct xfs_inode *ip, u64 pos, unsigned int length),
> +	TP_ARGS(ip, pos, length),
> +	TP_STRUCT__entry(
> +		__field(dev_t, dev)
> +		__field(xfs_ino_t, ino)
> +		__field(u64, pos)
> +		__field(unsigned int, length)
> +	),
> +	TP_fast_assign(
> +		__entry->dev = VFS_I(ip)->i_sb->s_dev;
> +		__entry->ino = ip->i_ino;
> +		__entry->pos = pos;
> +		__entry->length = length;
> +	),
> +	TP_printk("dev %d:%d ino 0x%llx pos %llx length %x",

pos and length should have '0x' before them since they're presented in
hexadecimal.

Otherwise this looks ok so
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D


> +		  MAJOR(__entry->dev), MINOR(__entry->dev),
> +		  __entry->ino,
> +		  __entry->pos,
> +		  __entry->length)
> +)
> +
> +#define DEFINE_FSVERITY_EVENT(name) \
> +DEFINE_EVENT(xfs_fsverity_class, name, \
> +	TP_PROTO(struct xfs_inode *ip, u64 pos, unsigned int length), \
> +	TP_ARGS(ip, pos, length))
> +DEFINE_FSVERITY_EVENT(xfs_fsverity_read_merkle);
> +DEFINE_FSVERITY_EVENT(xfs_fsverity_write_merkle);
> +DEFINE_FSVERITY_EVENT(xfs_fsverity_file_corrupt);
> +
>  #endif /* _TRACE_XFS_H */
>  
>  #undef TRACE_INCLUDE_PATH
> 
> -- 
> - Andrey
> 
> 

  reply	other threads:[~2026-01-12 23:07 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-12 14:49 [PATCH v2 0/23] fs-verity support for XFS with post EOF merkle tree Andrey Albershteyn
2026-01-12 14:49 ` [PATCH v2 1/22] fsverity: report validation errors back to the filesystem Darrick J. Wong
2026-01-13  1:29   ` Darrick J. Wong
2026-01-13  8:09     ` Christoph Hellwig
2026-01-13 10:27     ` Andrey Albershteyn
2026-01-13 17:52       ` Darrick J. Wong
2026-01-12 14:49 ` [PATCH v2 2/22] fsverity: expose ensure_fsverity_info() Andrey Albershteyn
2026-01-12 22:05   ` Darrick J. Wong
2026-01-12 14:50 ` [PATCH v2 3/22] iomap: introduce IOMAP_F_BEYOND_EOF Andrey Albershteyn
2026-01-12 22:18   ` Darrick J. Wong
2026-01-12 22:31     ` Darrick J. Wong
2026-01-13 10:39       ` Andrey Albershteyn
2026-01-13  8:12     ` Christoph Hellwig
2026-01-13 10:50       ` Andrey Albershteyn
2026-01-13 16:22         ` Christoph Hellwig
2026-01-13 17:57           ` Darrick J. Wong
2026-01-16 21:52   ` Matthew Wilcox
2026-01-17  2:11     ` Darrick J. Wong
2026-01-12 14:50 ` [PATCH v2 4/22] iomap: allow iomap_file_buffered_write() take iocb without file Andrey Albershteyn
2026-01-12 22:22   ` Darrick J. Wong
2026-01-13  8:15     ` Christoph Hellwig
2026-01-13 10:53       ` Andrey Albershteyn
2026-01-13 16:43       ` Matthew Wilcox
2026-01-14  4:49         ` Matthew Wilcox
2026-01-14  6:41         ` Christoph Hellwig
2026-01-14 16:43           ` Darrick J. Wong
2026-01-12 14:50 ` [PATCH v2 5/22] iomap: integrate fs-verity verification into iomap's read path Andrey Albershteyn
2026-01-12 22:35   ` Darrick J. Wong
2026-01-13 11:16     ` Andrey Albershteyn
2026-01-13 16:23       ` Christoph Hellwig
2026-01-13  8:19   ` Christoph Hellwig
2026-01-12 14:50 ` [PATCH v2 6/22] xfs: add fs-verity ro-compat flag Andrey Albershteyn
2026-01-12 14:50 ` [PATCH v2 7/22] xfs: add inode on-disk VERITY flag Andrey Albershteyn
2026-01-12 14:50 ` [PATCH v2 8/22] xfs: initialize fs-verity on file open and cleanup on inode destruction Andrey Albershteyn
2026-01-12 14:50 ` [PATCH v2 9/22] xfs: don't allow to enable DAX on fs-verity sealed inode Andrey Albershteyn
2026-01-12 14:51 ` [PATCH v2 10/22] xfs: disable direct read path for fs-verity files Andrey Albershteyn
2026-01-13  8:20   ` Christoph Hellwig
2026-01-13 11:22     ` Andrey Albershteyn
2026-01-12 14:51 ` [PATCH v2 11/22] xfs: add verity info pointer to xfs inode Andrey Albershteyn
2026-01-12 22:39   ` Darrick J. Wong
2026-01-13  8:21     ` Christoph Hellwig
2026-01-13 18:02       ` Darrick J. Wong
2026-01-14  6:43         ` Christoph Hellwig
2026-01-12 14:51 ` [PATCH v2 12/22] xfs: introduce XFS_FSVERITY_CONSTRUCTION inode flag Andrey Albershteyn
2026-01-12 22:42   ` Darrick J. Wong
2026-01-13 11:24     ` Andrey Albershteyn
2026-01-12 14:51 ` [PATCH v2 13/22] xfs: introduce XFS_FSVERITY_REGION_START constant Andrey Albershteyn
2026-01-12 22:46   ` Darrick J. Wong
2026-01-13 12:23     ` Andrey Albershteyn
2026-01-13 18:06       ` Darrick J. Wong
2026-01-14  6:47         ` Christoph Hellwig
2026-01-14  7:59           ` Andrey Albershteyn
2026-01-14 16:50           ` Darrick J. Wong
2026-01-12 14:51 ` [PATCH v2 14/22] xfs: disable preallocations for fsverity Merkle tree writes Andrey Albershteyn
2026-01-12 22:49   ` Darrick J. Wong
2026-01-12 14:51 ` [PATCH v2 15/22] xfs: add writeback and iomap reading of Merkle tree pages Andrey Albershteyn
2026-01-12 22:51   ` Darrick J. Wong
2026-01-13  8:23     ` Christoph Hellwig
2026-01-13 12:31       ` Andrey Albershteyn
2026-01-12 14:51 ` [PATCH v2 16/22] xfs: add fs-verity support Andrey Albershteyn
2026-01-12 23:05   ` Darrick J. Wong
2026-01-13 18:32     ` Andrey Albershteyn
2026-01-14 16:40       ` Darrick J. Wong
2026-01-16 14:52     ` Andrey Albershteyn
2026-01-12 14:51 ` [PATCH v2 17/22] xfs: add fs-verity ioctls Andrey Albershteyn
2026-01-12 14:52 ` [PATCH v2 18/22] xfs: advertise fs-verity being available on filesystem Darrick J. Wong
2026-01-12 14:52 ` [PATCH v2 19/22] xfs: check and repair the verity inode flag state Darrick J. Wong
2026-01-12 14:52 ` [PATCH v2 20/22] xfs: report verity failures through the health system Darrick J. Wong
2026-01-12 14:52 ` [PATCH v2 21/22] xfs: add fsverity traces Andrey Albershteyn
2026-01-12 23:07   ` Darrick J. Wong [this message]
2026-01-12 14:52 ` [PATCH v2 22/22] xfs: enable ro-compat fs-verity flag Andrey Albershteyn
2026-01-13 16:36 ` [PATCH v2 0/23] fs-verity support for XFS with post EOF merkle tree Matthew Wilcox
2026-01-13 18:45   ` Andrey Albershteyn
2026-01-14  5:00     ` Matthew Wilcox
2026-01-14  6:15       ` Darrick J. Wong
2026-01-14  8:20         ` Andrey Albershteyn
2026-01-14  9:53           ` Andrey Albershteyn
2026-01-14 16:42             ` Darrick J. Wong
2026-01-19  6:33             ` fsverity metadata offset, was: " Christoph Hellwig
2026-01-19 19:32               ` Eric Biggers
2026-01-19 19:58                 ` Darrick J. Wong
2026-01-20  7:32                   ` Christoph Hellwig
2026-01-20 11:44                     ` Andrey Albershteyn
2026-01-20 17:34                       ` Darrick J. Wong
2026-01-21 15:03                       ` Christoph Hellwig
2026-01-19 20:00                 ` Matthew Wilcox

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=20260112230725.GS15551@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=aalbersh@kernel.org \
    --cc=aalbersh@redhat.com \
    --cc=david@fromorbit.com \
    --cc=ebiggers@kernel.org \
    --cc=fsverity@lists.linux.dev \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /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