[Cluster-devel] [RFC 9/9] gfs2: Fix mmap + page fault deadlocks (part 2)

Linus Torvalds torvalds at linux-foundation.org
Tue Jun 1 05:47:28 UTC 2021


On Mon, May 31, 2021 at 7:02 AM Andreas Gruenbacher <agruenba at redhat.com> wrote:
>
> @@ -807,13 +824,20 @@ static ssize_t gfs2_file_direct_read(struct kiocb *iocb, struct iov_iter *to,
> [...]
>         ret = iomap_dio_rw(iocb, to, &gfs2_iomap_ops, NULL, 0);
>         gfs2_glock_dq(gh);
> +       if (unlikely(current_needs_retry())) {
> +               set_current_needs_retry(false);
> +               if (ret == -EFAULT &&
> +                   !iov_iter_fault_in_writeable(to, PAGE_SIZE))
> +                       goto retry;
> +       }

Hmm. I haven't walked through this all, but is that "ret == -EFAULT"
test the right thing to do?

Can iomap_dio_rw() not instead just return a partial success if it hit
a missing page half-way?

Shouldn't you retry for that case too?

                Linus




More information about the Cluster-devel mailing list