Re: [PATCH] splice: avoid stale f_pos writeback on error

From: Christian Brauner

Date: Fri Oct 30 2026 - 10:57:32 EST


On Sun, 18 Oct 2026 14:17:08 +0900, Daehyeon Ko wrote:
> do_splice() snapshots an implicit file position before calling the splice
> helper. Since splice does not take f_pos_lock, another operation on the
> same open file description can update f_pos while the helper is blocked.
> If the helper then fails, the unconditional writeback restores the stale
> snapshot.
>
> For a directory without ->splice_read, a file-to-pipe splice fails with
> -EINVAL. A concurrent directory mutation and getdents() call can advance
> f_pos and refresh the filesystem's revalidation cookie before that failure
> restores only the old position. The next ext2 readdir can then trust an
> offset inside a directory entry and copy data from the adjacent page to
> userspace.
>
> [...]

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] splice: avoid stale f_pos writeback on error
https://git.kernel.org/vfs/vfs/c/79b496ebe382