Skip to content

Commit 09f8ac7

Browse files
AstralBobgregkh
authored andcommitted
gfs2: Don't demote a glock until its revokes are written
[ Upstream commit df5db5f ] Before this patch, run_queue would demote glocks based on whether there are any more holders. But if the glock has pending revokes that haven't been written to the media, giving up the glock might end in file system corruption if the revokes never get written due to io errors, node crashes and fences, etc. In that case, another node will replay the metadata blocks associated with the glock, but because the revoke was never written, it could replay that block even though the glock had since been granted to another node who might have made changes. This patch changes the logic in run_queue so that it never demotes a glock until its count of pending revokes reaches zero. Signed-off-by: Bob Peterson <[email protected]> Reviewed-by: Andreas Gruenbacher <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 3e61c4f commit 09f8ac7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/gfs2/glock.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,9 @@ __acquires(&gl->gl_lockref.lock)
636636
goto out_unlock;
637637
if (nonblock)
638638
goto out_sched;
639+
smp_mb();
640+
if (atomic_read(&gl->gl_revokes) != 0)
641+
goto out_sched;
639642
set_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags);
640643
GLOCK_BUG_ON(gl, gl->gl_demote_state == LM_ST_EXCLUSIVE);
641644
gl->gl_target = gl->gl_demote_state;

0 commit comments

Comments
 (0)