Re: [PATCH] pipe: annotate lockless checks of the file count

From: Christian Brauner

Date: Fri Nov 20 2026 - 04:30:31 EST


On Wed, 11 Nov 2026 14:47:17 +0800, Zhu Jun wrote:
> pipe_lock() and pipe_unlock() inspect pipe->files without inode->i_lock,
> while opening or closing a pipe changes the count under that lock. KCSAN
> reports these checks racing with put_pipe_info().
>
> Only the zero/nonzero distinction matters here: a caller's file reference
> keeps the count nonzero for a regular pipe or FIFO, and an internal splice
> pipe has no files. Use data_race(READ_ONCE()) to document that distinction
> and take a single snapshot without changing the file-count writers.
>
> [...]

Applied to the vfs.fixes branch of the vfs/vfs.git tree.
Patches in the vfs.fixes 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.fixes

[1/1] pipe: annotate lockless checks of the file count
https://git.kernel.org/vfs/vfs/c/12a0e69b748c