From: Matthew Wilcox (Oracle) Date: Sat, 12 Aug 2023 00:20:33 +0000 (+0100) Subject: mm: allow fault_dirty_shared_page() to be called under the VMA lock X-Git-Tag: kvm-x86-next-2023.09.07~124^2~95 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0790e1e2b1b71ba357e89e779451efe79dff28e6;p=users%2Fdwmw2%2Flinux.git mm: allow fault_dirty_shared_page() to be called under the VMA lock By making maybe_unlock_mmap_for_io() handle the VMA lock correctly, we make fault_dirty_shared_page() safe to be called without the mmap lock held. Link: https://lkml.kernel.org/r/20230812002033.1002367-1-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) Reported-by: David Hildenbrand Tested-by: Suren Baghdasaryan Signed-off-by: Andrew Morton --- diff --git a/mm/internal.h b/mm/internal.h index a037b1b37f6d7..c6ed10f0a5ad4 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -706,7 +706,7 @@ static inline struct file *maybe_unlock_mmap_for_io(struct vm_fault *vmf, if (fault_flag_allow_retry_first(flags) && !(flags & FAULT_FLAG_RETRY_NOWAIT)) { fpin = get_file(vmf->vma->vm_file); - mmap_read_unlock(vmf->vma->vm_mm); + release_fault_lock(vmf); } return fpin; }