Skip to content

Commit

Permalink
gfs2: read-only mounts should grab the sd_freeze_gl glock
Browse files Browse the repository at this point in the history
Before this patch, only read-write mounts would grab the freeze
glock in read-only mode, as part of gfs2_make_fs_rw. So the freeze
glock was never initialized. That meant requests to freeze, which
request the glock in EX, were granted without any state transition.
That meant you could mount a gfs2 file system, which is currently
frozen on a different cluster node, in read-only mode.

This patch makes read-only mounts lock the freeze glock in SH mode,
which will block for file systems that are frozen on another node.

Signed-off-by: Bob Peterson <[email protected]>
  • Loading branch information
AstralBob authored and Andreas Gruenbacher committed Jul 3, 2020
1 parent 541656d commit b780cc6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion fs/gfs2/ops_fstype.c
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,17 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc)
goto fail_per_node;
}

if (!sb_rdonly(sb)) {
if (sb_rdonly(sb)) {
struct gfs2_holder freeze_gh;

error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED,
GL_EXACT, &freeze_gh);
if (error) {
fs_err(sdp, "can't make FS RO: %d\n", error);
goto fail_per_node;
}
gfs2_glock_dq_uninit(&freeze_gh);
} else {
error = gfs2_make_fs_rw(sdp);
if (error) {
fs_err(sdp, "can't make FS RW: %d\n", error);
Expand Down

0 comments on commit b780cc6

Please sign in to comment.