gfs2: Don't freeze the file system during unmount
PATCH 1/1 gfs2: Don't freeze the file system during unmount
In reply to a message not in the archiveHi,
GFS2's freeze/thaw mechanism uses a special freeze glock to control its operation. It does this with a sync glock operation (glops.c) called freeze_go_sync. When the freeze glock is demoted (glock's do_xmote) the glops function causes the file system to be frozen. This is intended. However, GFS2's mount and unmount processes also hold the freeze glock to prevent other processes, perhaps on different cluster nodes, from mounting the frozen file system in read-write mode.
Before this patch, there was no check in freeze_go_sync for whether a freeze in intended or whether the glock demote was caused by a normal unmount. So it was trying to freeze the file system it's trying to unmount, which ends up in a deadlock.
This patch adds an additional check to freeze_go_sync so that demotes of the freeze glock are ignored if they come from the unmount process.
--- fs/gfs2/glops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/gfs2/glops.c +2 -1
@@ -582,7 +582,8 @@ static int freeze_go_sync(struct gfs2_glock *gl)* Once thawed, the work func acquires the freeze glock in * SH and everybody goes back to thawed. */ -if (gl->gl_state ==LM_ST_SHARED && !gfs2_withdrawn (sdp)) { +if (gl->gl_state ==LM_ST_SHARED && !gfs2_withdrawn (sdp) && + !test_bit (SDF_NORECOVERY , &sdp->sd_flags)) {atomic_set (&sdp->sd_freeze_state,SFS_STARTING_FREEZE ); error =freeze_super (sdp->sd_vfs);if (error) {
Andreas Gruenbacher
maintainerPATCH 1/1 gfs2: Don't freeze the file system during unmount
Hi Bob,
Quoted 26 lines · Bob Peterson
GFS2's freeze/thaw mechanism uses a special freeze glock to control its operation. It does this with a sync glock operation (
glops.c) calledfreeze_go_sync. When the freeze glock is demoted (glock'sdo_xmote) the glops function causes the file system to be frozen. This is intended. However, GFS2's mount and unmount processes also hold the freeze glock to prevent other processes, perhaps on different cluster nodes, from mounting the frozen file system in read-write mode.Before this patch, there was no check in
freeze_go_syncfor whether a freeze in intended or whether the glock demote was caused by a normal unmount. So it was trying to freeze the file system it's trying to unmount, which ends up in a deadlock.This patch adds an additional check to
freeze_go_syncso that demotes of the freeze glock are ignored if they come from the unmount process.Signed-off-by Bob Peterson <[email protected]>--- fs/gfs2/glops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/gfs2/glops.c +0
-0
fs/gfs2/glops.c static int freeze_go_sync(struct gfs2_glock *gl) · line 589
Quoted 9 lines
fs/gfs2/glops.c +2
-1@@ -582,7 +582,8 @@ static int freeze_go_sync(struct gfs2_glock *gl)* Once thawed, the work func acquires the freeze glock in * SH and everybody goes back to thawed. */ -if (gl->gl_state ==LM_ST_SHARED && !gfs2_withdrawn (sdp)) { +if (gl->gl_state ==LM_ST_SHARED && !gfs2_withdrawn (sdp) && + !test_bit (SDF_NORECOVERY , &sdp->sd_flags)) {atomic_set (&sdp->sd_freeze_state,SFS_STARTING_FREEZE ); error =freeze_super (sdp->sd_vfs);if (error) {
I'll send this to Linus in the next batch of 5.10 fixes.
Thanks,
Andreas