diff options
| author | Jiale Yao <yaojiale02@163.com> | 2026-09-24 18:51:23 +0800 |
|---|---|---|
| committer | Jan Kara <jack@suse.cz> | 2026-09-24 14:47:38 +0200 |
| commit | 1e2ef9f221e142ed19d874a71b2cae7fabbaf138 (patch) | |
| tree | d6e63fb57f81d9ecebf8ff6711b0c33758a480bb /tools/perf/scripts/python/bin/stackcollapse-report | |
| parent | 6e69419ca6a4bfc3f3445ab139fd07a0e9cf74be (diff) | |
| download | linux-1e2ef9f221e142ed19d874a71b2cae7fabbaf138.tar.gz linux-1e2ef9f221e142ed19d874a71b2cae7fabbaf138.zip | |
ext2: drain in-flight DIO before buffered write fallback
An asynchronous direct write can remain in flight after the inode lock is
released. If another direct write falls back to buffered I/O while the
first write is still pending, generic_perform_write() can dirty pages
before the first write completes its post-I/O page cache invalidation.
The invalidation then finds dirty pages, reports a page cache invalidation
failure, and records -EIO in the mapping error sequence. A later fsync()
therefore returns -EIO.
Commit 15cdefd0c0522f9d5e12d947fa04f4c11649b699 ("ext4: drain
in-flight DIO before buffered write fallback") fixed the same race in
ext4. Ext2 has an equivalent fallback after iomap_dio_rw() returns
-ENOTBLK or a short write, but does not drain other in-flight DIO before
dirtying the page cache.
Wait for in-flight DIO before calling generic_perform_write() in the
fallback path.
A reproducer using concurrent AIO direct writes and buffered fallback
triggered the following warning 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!
Fixes: fb5de4358e1a ("ext2: Move direct-io to use iomap")
Link: https://lore.kernel.org/r/20260629113827.4074335-3-libaokun@linux.alibaba.com
Signed-off-by: Jiale Yao <yaojiale02@163.com>
Link: https://patch.msgid.link/20260924105125.577714-2-yaojiale02@163.com
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-report')
0 files changed, 0 insertions, 0 deletions
