gfs2: No short reads or writes upon glock contention

[ Upstream commit 296abc0d91 ]

Commit 00bfe02f47 ("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: 00bfe02f47 ("gfs2: Fix mmap + page fault deadlocks for buffered I/O")
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Andreas Gruenbacher 2022-04-28 14:51:33 +02:00 коммит произвёл Greg Kroah-Hartman
Родитель b5afb477d2
Коммит 3591293c19
1 изменённых файлов: 0 добавлений и 4 удалений

Просмотреть файл

@ -998,8 +998,6 @@ retry_under_glock:
if (leftover != window_size) { if (leftover != window_size) {
if (gfs2_holder_queued(&gh)) if (gfs2_holder_queued(&gh))
goto retry_under_glock; goto retry_under_glock;
if (written)
goto out_uninit;
goto retry; goto retry;
} }
} }
@ -1076,8 +1074,6 @@ retry_under_glock:
from->count = min(from->count, window_size - leftover); from->count = min(from->count, window_size - leftover);
if (gfs2_holder_queued(gh)) if (gfs2_holder_queued(gh))
goto retry_under_glock; goto retry_under_glock;
if (read && !(iocb->ki_flags & IOCB_DIRECT))
goto out_uninit;
goto retry; goto retry;
} }
} }