gfs2: Fix up gfs2_glock_async_wait
authorAndreas Gruenbacher <agruenba@redhat.com>
Thu, 9 Jun 2022 11:39:10 +0000 (13:39 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Wed, 29 Jun 2022 14:47:44 +0000 (16:47 +0200)
commitbdff777cbb582da52cf4b536adc0815a41b407ed
tree4b985f4231e48d36ee3b0dde73b079fb4cd718d2
parent03c765b0e3b4cb5063276b086c76f7a612856a9a
gfs2: Fix up gfs2_glock_async_wait

Since commit 1fc05c8d8426 ("gfs2: cancel timed-out glock requests"), a
pending locking request can be canceled by calling gfs2_glock_dq() on
the pending holder.  In gfs2_glock_async_wait(), when we time out, use
that to cancel the remaining locking requests and dequeue the locking
requests already granted.  That's simpler as well as more efficient than
waiting for all locking requests to eventually be granted and dequeuing
them then.

In addition, gfs2_glock_async_wait() promises that by the time the
function completes, all glocks are either granted or dequeued, but the
implementation doesn't keep that promise if individual locking requests
fail.  Fix that as well.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/glock.c