Skip to content

Commit

Permalink
gfs2: No short reads or writes upon glock contention
Browse files Browse the repository at this point in the history
Commit 00bfe02 ("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: 00bfe02 ("gfs2: Fix mmap + page fault deadlocks for buffered I/O")
Signed-off-by: Andreas Gruenbacher <[email protected]>
  • Loading branch information
Andreas Gruenbacher committed Apr 28, 2022
1 parent 4fad37d commit 296abc0
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions fs/gfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -991,8 +991,6 @@ static ssize_t gfs2_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
if (leftover != window_size) {
if (gfs2_holder_queued(&gh))
goto retry_under_glock;
if (written)
goto out_uninit;
goto retry;
}
}
Expand Down Expand Up @@ -1069,8 +1067,6 @@ static ssize_t gfs2_file_buffered_write(struct kiocb *iocb,
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;
}
}
Expand Down

0 comments on commit 296abc0

Please sign in to comment.