]> git.baikalelectronics.ru Git - kernel.git/commit
gfs2: Fix mmap + page fault deadlocks for direct I/O
authorAndreas Gruenbacher <agruenba@redhat.com>
Thu, 14 Apr 2022 22:28:53 +0000 (06:28 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 1 May 2022 15:22:33 +0000 (17:22 +0200)
commitbc13a5a9368e7782b354ad0f558c71813c37aa8e
treefa2aabf3db3f5736d4319b15a02c6b1e181dfa87
parentb5f6f73b36d7a5757220127ffe00cad4ae0dc9ac
gfs2: Fix mmap + page fault deadlocks for direct I/O

commit 77d7b2e48bc32ae83f20ee368343fa237e10834d upstream

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>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/gfs2/file.c