On Fri, Jan 23, 2026 at 05:31:17PM +0800, Baolin Wang wrote: > > > On 1/23/26 1:07 PM, Lance Yang wrote: > > > > > > After collapse_single_pmd() returns, mmap_lock might have been released. > > Between > > that unlock and here, another thread could unmap/remap the VMA, making > > the vma > > pointer stale when we access vma->vm_file? > > > > Would it be safer to get the file reference before calling > > collapse_single_pmd()? > > Or we need to revalidate the VMA after getting the lock back? > Good catch. I think we can move the filemap_write_and_wait_range() related > logic into collapse_single_pmd(), after we get a file reference.
Good suggestion, is what Nico did in the suggested patch :) Agreed better there. Thanks, Lorenzo
