Skip to content

Commit e11b02d

Browse files
author
Andreas Gruenbacher
committed
gfs2: Fix remote demote of weak glock holders
When we mock up a temporary holder in gfs2_glock_cb to demote weak holders in response to a remote locking conflict, we don't set the HIF_HOLDER flag. This causes function may_grant to BUG. Fix by setting the missing HIF_HOLDER flag in the mock glock holder. In addition, define the mock glock holder where it is used. Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 42eb8fd commit e11b02d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

fs/gfs2/glock.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1857,7 +1857,6 @@ void gfs2_glock_dq_m(unsigned int num_gh, struct gfs2_holder *ghs)
18571857

18581858
void gfs2_glock_cb(struct gfs2_glock *gl, unsigned int state)
18591859
{
1860-
struct gfs2_holder mock_gh = { .gh_gl = gl, .gh_state = state, };
18611860
unsigned long delay = 0;
18621861
unsigned long holdtime;
18631862
unsigned long now = jiffies;
@@ -1890,8 +1889,13 @@ void gfs2_glock_cb(struct gfs2_glock *gl, unsigned int state)
18901889
* keep the glock until the last strong holder is done with it.
18911890
*/
18921891
if (!find_first_strong_holder(gl)) {
1893-
if (state == LM_ST_UNLOCKED)
1894-
mock_gh.gh_state = LM_ST_EXCLUSIVE;
1892+
struct gfs2_holder mock_gh = {
1893+
.gh_gl = gl,
1894+
.gh_state = (state == LM_ST_UNLOCKED) ?
1895+
LM_ST_EXCLUSIVE : state,
1896+
.gh_iflags = BIT(HIF_HOLDER)
1897+
};
1898+
18951899
demote_incompat_holders(gl, &mock_gh);
18961900
}
18971901
handle_callback(gl, state, delay, true);

0 commit comments

Comments
 (0)