[Cluster-devel] [PATCH v5 00/12] gfs2: Fix mmap + page fault deadlocks
torvalds at linux-foundation.org
Wed Aug 18 21:49:28 UTC 2021
[ Sorry for the delay, I was on the road and this fell through the cracks ]
On Mon, Aug 16, 2021 at 12:14 PM Andreas Gruenbacher
<agruenba at redhat.com> wrote:
> On Tue, Aug 3, 2021 at 9:45 PM Linus Torvalds
> <torvalds at linux-foundation.org> wrote:
> > Hmm. Have you tried to figure out why that "still returns 0" happens?
> The call stack is:
> In gup_pte_range, pte_special(pte) is true and so we return 0.
Ok, so that is indeed something that the fast-case can't handle,
because some of the special code wants to have the mm_lock so that it
can look at the vma flags (eg "vm_normal_page()" and friends.
That said, some of these cases even the full GUP won't ever handle,
simply because a mapping doesn't necessarily even _have_ a 'struct
page' associated with it if it's a VM_IO mapping.
So it turns out that you can't just always do
fault_in_iov_iter_readable() and then assume that you can do
iov_iter_get_pages() and repeat until successful.
We could certainly make get_user_pages_fast() handle a few more cases,
but I get the feeling that we need to have separate error cases for
EFAULT - no page exists - and the "page exists, but cannot be mapped
as a 'struct page'" case.
I also do still think that even regardless of that, we want to just
add a FOLL_NOFAULT flag that just disables calling handle_mm_fault(),
and then you can use the regular get_user_pages().
That at least gives us the full _normal_ page handling stuff.
More information about the Cluster-devel