[PATCH 05/46] mm/truncate: look again if a folio left the mapping

Rik van Riel riel at surriel.com
Mon Oct 26 19:17:05 PDT 2026


On Tue, 2026-10-27 at 00:17 +0100, David Hildenbrand (Arm) wrote:
> 
> In that scenario, the collapsed folio with the data from before the
> write
> stays in the page cache after the write has returned.
> 
> This used to be impossible, as khugepaged only collapsed files that
> nobody
> had open for writing.
> 
> Restart the lookup at that index, like shmem_undo_range() does. The
> same
> problem seems to exist in truncate_inode_pages_range() as well when
> truncate_inode_folio() fails, so handle it there as well.
> 
> Fixes: 1b6444331beb ("mm/khugepaged: enable clean pagecache folio
> collapse for writable files")
> Cc: stable at vger.kernel.org
> Reported-by: Josef Bacik <josef at toxicpanda.com>
> Signed-off-by: David Hildenbrand (Arm) <david at kernel.org>

Reviewed-by: Rik van Riel <riel at surriel.com>

-- 
All Rights Reversed.



More information about the kexec mailing list