diff options
| author | Chris Mason <mason@kernel.org> | 2026-11-12 16:46:11 -0500 |
|---|---|---|
| committer | Carlos Maiolino <cem@kernel.org> | 2026-11-16 11:45:49 +0100 |
| commit | 3b6942b132033cbc3f6566f698709d9038daf7b2 (patch) | |
| tree | 678872952ab67734e01a06e9268fd006544e99c1 /tools/perf/scripts/python/bin | |
| parent | 765db499ad5837365b445b26b6fc81f30f134758 (diff) | |
xfs: test for reflink after the dio write checks
A direct write that is not block aligned can expose stale disk contents
on XFS if it races with the first clone of the file.
xfs_file_dio_write_unaligned() falls back to buffered I/O if the file is
reflinked, and tests for that right after it takes the iolock. But
xfs_file_write_checks() runs after the test and can drop the iolock, for
example if S_NOSEC is not set. A clone can run in that gap:
direct write clone
============ =====
takes the iolock shared
sees that the file is not reflinked
drops the iolock
shares the blocks
takes the iolock exclusive
writes a part of a new COW block
maps the whole block into the file
/* the rest was never written */
The fix used here is to move the test after xfs_file_write_checks().
Fixes: ed1128c2d0c8 ("xfs: reduce exclusive locking on unaligned dio")
Signed-off-by: Chris Mason <mason@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/bin')
0 files changed, 0 insertions, 0 deletions
