gfs2: Fix mmap + page fault deadlocks for direct I/O
authorAndreas Gruenbacher <agruenba@redhat.com>
Mon, 12 Jul 2021 11:40:38 +0000 (13:40 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Mon, 25 Oct 2021 06:42:14 +0000 (08:42 +0200)
commitb01b2d72da25c000aeb124bc78daf3fb998be2b6
tree03b35cd01f2837299ab4856fc88cdb3ef5e8b05a
parent3337ab08d08b1a375f88471d9c8b1cac968cb054
gfs2: Fix mmap + page fault deadlocks for direct I/O

Also disable page faults during direct I/O requests and implement a
similar kind of retry logic as in the buffered I/O case.

The retry logic in the direct I/O case differs from the buffered I/O
case in the following way: direct I/O doesn't provide the kinds of
consistency guarantees between concurrent reads and writes that buffered
I/O provides, so once we lose the inode glock while faulting in user
pages, we always resume the operation.  We never need to return a
partial read or write.

This locking problem was originally reported by Jan Kara.  Linus came up
with the idea of disabling page faults.  Many thanks to Al Viro and
Matthew Wilcox for their feedback.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/file.c