Re: [PATCH] fs: annotate data race in get_nr_inodes()

From: Christian Brauner

Date: Thu Nov 05 2026 - 16:51:33 EST


On Tue, 27 Oct 2026 16:08:49 -0400, Mani Tofigh wrote:
> get_nr_inodes() sums the per-CPU inode counts without a lock, and the
> result is only an estimate, so it's harmless if one of them changes
> during the sum. Wrap the reads in data_race() to mark this.
>
> [ 11.857490] BUG: KCSAN: data-race in get_nr_inodes+0x9f/0xf0
>
> [ 11.857568] race at unknown origin, with read to 0xff1100002b6281e8 of 8 bytes by task 106 on cpu 1:
> [ 11.857621] get_nr_inodes+0x9f/0xf0
> [ 11.857675] get_nr_dirty_inodes+0x1d/0x110
> [ 11.857748] writeback_inodes_sb+0x3d/0x60
> ...
>
> [...]

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] fs: annotate data race in get_nr_inodes()
https://git.kernel.org/vfs/vfs/c/067a2ab608e0