]> git.baikalelectronics.ru Git - kernel.git/commitdiff
gfs2: No short reads or writes upon glock contention
authorAndreas Gruenbacher <agruenba@redhat.com>
Thu, 28 Apr 2022 12:51:33 +0000 (14:51 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Thu, 28 Apr 2022 13:14:48 +0000 (15:14 +0200)
Commit 9d0ff4feb1a7 ("gfs2: Fix mmap + page fault deadlocks for buffered
I/O") changed gfs2_file_read_iter() and gfs2_file_buffered_write() to
allow dropping the inode glock while faulting in user buffers.  When the
lock was dropped, a short result was returned to indicate that the
operation was interrupted.

As pointed out by Linus (see the link below), this behavior is broken
and the operations should always re-acquire the inode glock and resume
the operation instead.

Link: https://lore.kernel.org/lkml/CAHk-=whaz-g_nOOoo8RRiWNjnv2R+h6_xk2F1J4TuSRxk1MtLw@mail.gmail.com/
Fixes: 9d0ff4feb1a7 ("gfs2: Fix mmap + page fault deadlocks for buffered I/O")
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/file.c

index 8d889235afcdeff7a28fe95d05a6fc742648038b..48f01323c37c1b2d7e5bfb5b122569d64bc592d2 100644 (file)
@@ -991,8 +991,6 @@ retry_under_glock:
                if (leftover != window_size) {
                        if (gfs2_holder_queued(&gh))
                                goto retry_under_glock;
-                       if (written)
-                               goto out_uninit;
                        goto retry;
                }
        }
@@ -1069,8 +1067,6 @@ retry_under_glock:
                        from->count = min(from->count, window_size - leftover);
                        if (gfs2_holder_queued(gh))
                                goto retry_under_glock;
-                       if (read && !(iocb->ki_flags & IOCB_DIRECT))
-                               goto out_uninit;
                        goto retry;
                }
        }