Re: 6.6.8 stable: crash in folio_mark_dirty

From: Hillf Danton
Date: Wed Jan 03 2024 - 05:49:41 EST


On Mon, 1 Jan 2024 14:11:02 +0000 Matthew Wilcox
>
> From an mm point of view, what is implicit is that truncate calls
> unmap_mapping_folio -> unmap_mapping_range_tree ->
> unmap_mapping_range_vma -> zap_page_range_single -> unmap_single_vma ->
> unmap_page_range -> zap_p4d_range -> zap_pud_range -> zap_pmd_range ->
> zap_pte_range -> pte_offset_map_lock()
>
> So a truncate will take the page lock, then spin on the pte lock
> until the racing munmap() has finished (ok, this was an exit(), not
> a munmap(), but exit() does an implicit munmap()).
>
But ptl fails to explain the warning reported, while the sequence in
__block_commit_write()

mark_buffer_dirty();
folio_mark_uptodate();

hints the warning is bogus.