[PATCH v4 0/8] gfs2: Fix mmap + page fault deadlocks

From: Andreas Gruenbacher
Date: Sat Jul 24 2021 - 15:35:09 EST


Hi Linus et al.,

here's another update of this patch queue:

* Finally fix the typos Linus has pointed out twice already.

* Turn the previous fault_in_iov_iter helper that was used for reads
and writes into iov_iter_fault_in_writeable per Al's suggestion.
Use the existing iov_iter_fault_in_readable for writes.

* Add a done_before argument and an IOMAP_DIO_FAULT_RETRY flag to
iomap_dio_rw to allow iomap_dio_rw to return partial results and
resume with the rest of a request. This allows iomap_dio_rw to be
used with page faults disabled without having to repeat any I/O.

* Adjust the gfs2 patches accordingly.

With that, the two iov_ter patches and the three iomap patches should
hopefully be ready for mainline.

There's one remaining issue on the gfs2 side: during read requests, when
a writer now comes in in the middle of a read request, the read request
can currently return a result that never existed on disk. So we need
to ensure that we only resume read requests when we know that no writer
got in the way, and retry the entire request otherwise. It should be
relatively easy to add a mechanism to detect when a glock is "lost";
this won't affect the vfs or iomap patches.

Thanks a lot,
Andreas

Andreas Gruenbacher (8):
iov_iter: Introduce iov_iter_fault_in_writeable helper
gfs2: Add wrapper for iomap_file_buffered_write
gfs2: Fix mmap + page fault deadlocks for buffered I/O
iomap: Fix iomap_dio_rw return value for user copies
iomap: Add done_before argument to iomap_dio_rw
iomap: Support restarting direct I/O requests after user copy failures
iov_iter: Introduce noio flag to disable page faults
gfs2: Fix mmap + page fault deadlocks for direct I/O

fs/btrfs/file.c | 5 ++-
fs/ext4/file.c | 5 ++-
fs/gfs2/file.c | 95 +++++++++++++++++++++++++++++++++++++++----
fs/iomap/direct-io.c | 29 ++++++++++---
fs/xfs/xfs_file.c | 6 +--
fs/zonefs/super.c | 4 +-
include/linux/iomap.h | 11 ++++-
include/linux/mm.h | 3 ++
include/linux/uio.h | 2 +
lib/iov_iter.c | 60 ++++++++++++++++++++++++---
mm/gup.c | 57 ++++++++++++++++++++++++++
11 files changed, 246 insertions(+), 31 deletions(-)

--
2.26.3