Skip to content

Commit 52954b7

Browse files
author
Andreas Gruenbacher
committed
gfs2: Fix another freeze/thaw hang
On a thawed filesystem, the freeze glock is held in shared mode. In order to initiate a cluster-wide freeze, the node initiating the freeze drops the freeze glock and grabs it in exclusive mode. The other nodes recognize this as contention on the freeze glock; function freeze_go_callback is invoked. This indicates to them that they must freeze the filesystem locally, drop the freeze glock, and then re-acquire it in shared mode before being able to unfreeze the filesystem locally. While a node is trying to re-acquire the freeze glock in shared mode, additional contention can occur. In that case, the node must behave in the same way as above. Unfortunately, freeze_go_callback() contains a check that causes it to bail out when the freeze glock isn't held in shared mode. Fix that to allow the glock to be unlocked or held in shared mode. In addition, update a reference to trylock_super() which has been renamed to super_trylock_shared() in the meantime. Fixes: b77b4a4 ("gfs2: Rework freeze / thaw logic") Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 65d6e95 commit 52954b7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

fs/gfs2/glops.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -567,15 +567,16 @@ static void freeze_go_callback(struct gfs2_glock *gl, bool remote)
567567
struct super_block *sb = sdp->sd_vfs;
568568

569569
if (!remote ||
570-
gl->gl_state != LM_ST_SHARED ||
570+
(gl->gl_state != LM_ST_SHARED &&
571+
gl->gl_state != LM_ST_UNLOCKED) ||
571572
gl->gl_demote_state != LM_ST_UNLOCKED)
572573
return;
573574

574575
/*
575576
* Try to get an active super block reference to prevent racing with
576-
* unmount (see trylock_super()). But note that unmount isn't the only
577-
* place where a write lock on s_umount is taken, and we can fail here
578-
* because of things like remount as well.
577+
* unmount (see super_trylock_shared()). But note that unmount isn't
578+
* the only place where a write lock on s_umount is taken, and we can
579+
* fail here because of things like remount as well.
579580
*/
580581
if (down_read_trylock(&sb->s_umount)) {
581582
atomic_inc(&sb->s_active);

0 commit comments

Comments
 (0)