[PATCH 0/5] fs: drain in-flight DIO before buffered writes

From: Jiale Yao

Date: Sun Oct 25 2026 - 08:42:42 EST


An asynchronous direct write can remain in flight after its submitting
thread releases the filesystem's I/O submission lock. If a buffered write
dirties page cache before that direct write completes, post-I/O page-cache
invalidation can find dirty pages, report possible data corruption, and
record -EIO in the mapping error sequence.

Drain in-flight DIO before buffered writes in the generic filemap path,
F2FS, XFS, and zonefs. The filemap change also protects UDF and other
users of __generic_file_write_iter(). Keep IOCB_NOWAIT requests
nonblocking by returning -EAGAIN when a drain would be required.

The patches are separated by common code or filesystem and remain
independently buildable in series order.

Jiale Yao (5):
filemap: drain in-flight DIO before buffered writes
f2fs: drain in-flight DIO before buffered writes
xfs: drain in-flight DIO before buffered writes
xfs: drain in-flight DIO before zoned buffered writes
zonefs: drain in-flight DIO before buffered writes

fs/f2fs/file.c | 13 +++++++++++--
fs/xfs/xfs_file.c | 22 ++++++++++++++++++++++
fs/zonefs/file.c | 8 ++++++++
mm/filemap.c | 9 +++++++++
4 files changed, 50 insertions(+), 2 deletions(-)

--
2.34.1