Re: [PATCH] stat: annotate the lockless inode block count snapshot

From: Christian Brauner

Date: Wed Nov 18 2026 - 07:36:58 EST


On Wed, 11 Nov 2026 14:47:30 +0800, Zhu Jun wrote:
> generic_fillattr() reads i_blocks without inode->i_lock, while concurrent
> space accounting updates it under that lock. KCSAN reports the read
> racing with inode_add_bytes(), for example during a tmpfs write.
>
> The block count returned by stat is a snapshot taken while file contents
> may change. Annotate this intentional lockless read with data_race(),
> without marking or weakening the locked space-accounting updates.
>
> [...]

Applied to the vfs-7.5.misc branch of the vfs/vfs.git tree.
Patches in the vfs-7.5.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-7.5.misc

[1/1] stat: annotate the lockless inode block count snapshot
https://git.kernel.org/vfs/vfs/c/70e4c5f78aa5