gfs2: do_promote glock holder stealing fix
authorBob Peterson <rpeterso@redhat.com>
Fri, 10 Jun 2022 22:53:32 +0000 (00:53 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Wed, 29 Jun 2022 15:00:55 +0000 (17:00 +0200)
commit0befb8511e6a91716980c40c552acc5eec963cbd
tree9c469656279521973ba71c5ac90788513dc5c77b
parent8f0028fc60a42a1305040676ce22e5f5488efee5
gfs2: do_promote glock holder stealing fix

In do_promote(), when the glock had no strong holders, we were
accidentally calling demote_incompat_holders() with new_gh == NULL, so
no weak holders were considered incompatible.  Instead, the new holder
should have been passed in.

For doing that, the HIF_HOLDER flag needs to be set in new_gh to prevent
may_grant() from complaining.  This means that the new holder will now
be recognized as a current holder, so skip over it explicitly in
demote_incompat_holders() to prevent it from being dequeued.

To further clarify things, we can now rename new_gh to current_gh in
demote_incompat_holders(); after all, the HIF_HOLDER flag is already set,
which means the new holder is already a current holder.

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