Linux EXT4 FS development
 help / color / mirror / Atom feed
* [PATCH 0/3] fs: drain in-flight DIO before buffered write fallback
@ 2026-09-24 11:05 Jiale Yao
  2026-09-24 11:05 ` [PATCH 1/3] ext2: " Jiale Yao
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Jiale Yao @ 2026-09-24 11:05 UTC (permalink / raw)
  To: Namjae Jeon, Sungjong Seo, Yuezhang Mo, Jan Kara, Hyunchul Lee,
	Ritesh Harjani (IBM), Darrick J. Wong, exfat, linux-kernel,
	linux-ext4, ntfs
  Cc: Jiale Yao

An asynchronous direct write can remain in flight after its submitting
thread releases the inode lock.  If another direct write falls back to
buffered I/O in the meantime, the buffered write can dirty page cache
before the first write completes post-I/O invalidation.  The invalidation
then finds dirty pages, emits a page cache invalidation failure warning,
and records -EIO in the mapping error sequence.  A later fsync() returns
-EIO.

Commit 15cdefd0c0522f9d5e12d947fa04f4c11649b699 ("ext4: drain
in-flight DIO before buffered write fallback") fixed this race in ext4.
The same ordering is missing from the buffered fallback paths in ext2,
NTFS, and exFAT.

This series adds inode_dio_wait() before each fallback dirties page cache.
Each patch fixes one filesystem and remains independently buildable.

A reproducer using concurrent AIO direct writes and buffered fallback
triggered the following warning on all three filesystems and made a
subsequent fsync() return -EIO:

  Page cache invalidation failure on direct I/O.  Possible data corruption
  due to collision with buffered I/O!

Jiale Yao (3):
  ext2: drain in-flight DIO before buffered write fallback
  ntfs: drain in-flight DIO before buffered write fallback
  exfat: drain in-flight DIO before buffered write fallback

 fs/exfat/file.c | 6 ++++++
 fs/ext2/file.c  | 7 +++++++
 fs/ntfs/file.c  | 7 +++++++
 3 files changed, 20 insertions(+)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 13+ messages in thread
[parent not found: <20260924105125.577714-1-yaojiale02@163.com>]

end of thread, other threads:[~2026-09-26  7:30 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-24 11:05 [PATCH 0/3] fs: drain in-flight DIO before buffered write fallback Jiale Yao
2026-09-24 11:05 ` [PATCH 1/3] ext2: " Jiale Yao
2026-09-24 11:13   ` sashiko-bot
2026-09-24 11:05 ` [PATCH 2/3] ntfs: " Jiale Yao
2026-09-24 11:21   ` sashiko-bot
2026-09-24 12:04   ` liubaolin
2026-09-24 12:20     ` jiale yao
2026-09-26  7:29     ` jiale yao
2026-09-24 11:05 ` [PATCH 3/3] exfat: " Jiale Yao
2026-09-24 11:15   ` sashiko-bot
     [not found] <20260924105125.577714-1-yaojiale02@163.com>
2026-09-24 10:51 ` [PATCH 1/3] ext2: " Jiale Yao
2026-09-24 11:02   ` sashiko-bot
2026-09-24 12:48   ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox