diff options
| author | Chris Mason <mason@kernel.org> | 2026-11-09 18:51:14 -0500 |
|---|---|---|
| committer | Carlos Maiolino <cem@kernel.org> | 2026-11-10 11:23:11 +0100 |
| commit | a38c5aadc06a3277aa2bbdfa0d5161038ae1f4ff (patch) | |
| tree | 1188a8db03baf10ba1e7103d1e9d4502f7e6fd02 /tools/perf/scripts/python | |
| parent | d467837a485c3b811b94f4005825a05f1535adb3 (diff) | |
xfs: don't change the block map under a dirty folio
With CONFIG_TRANSPARENT_HUGEPAGE=y, writeback on XFS can write in place
to a shared block and corrupt the other file that shares it.
xfs_map_blocks() writes in place unless the COW fork has an extent for
the block. write() and write faults reserve one before they dirty a
folio over a shared block, so xfs_flush_unmap_range() writes back and
truncates the range before a clone changes the block map. But the holder
of a GUP write pin takes no filesystem lock, and the truncate keeps a
large dirty folio that straddles the range:
clone pin holder writeback
===== ========== =========
writes the range back
dirties the folio
truncate keeps the folio
maps a shared block under it
dirties it again
finds no COW extent
writes in place
/* shared block */
The fix used here is to invalidate the range instead of truncating it,
and to fail the call with -EINVAL if a dirty folio is left, before the
block map changes.
Fixes: 6795801366da ("xfs: Support large folios")
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')
0 files changed, 0 insertions, 0 deletions
