From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Bob Peterson <rpeterso@redhat.com>,
Sasha Levin <sashal@kernel.org>,
cluster-devel@redhat.com
Subject: [PATCH AUTOSEL 5.4 15/16] gfs2: read-only mounts should grab the sd_freeze_gl glock
Date: Wed, 8 Jul 2020 11:41:34 -0400 [thread overview]
Message-ID: <20200708154135.3199907-15-sashal@kernel.org> (raw)
In-Reply-To: <20200708154135.3199907-1-sashal@kernel.org>
From: Bob Peterson <rpeterso@redhat.com>
[ Upstream commit b780cc615ba4795a7ef0e93b19424828a5ad456a ]
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 <rpeterso@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/gfs2/ops_fstype.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index c26c864590cc3..e0c55765b06d2 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -1168,7 +1168,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);
--
2.25.1
next prev parent reply other threads:[~2020-07-08 15:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-08 15:41 [PATCH AUTOSEL 5.4 01/16] drm/msm: fix potential memleak in error branch Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 02/16] drm/msm/dpu: allow initialization of encoder locks during encoder init Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 03/16] ima: extend boot_aggregate with kernel measurements Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 04/16] drm/exynos: Properly propagate return value in drm_iommu_attach_device() Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 05/16] drm/exynos: fix ref count leak in mic_pre_enable Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 06/16] x86/fpu: Reset MXCSR to default in kernel_fpu_begin() Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 07/16] thermal/drivers: imx: Fix missing of_node_put() at probe time Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 08/16] blk-mq-debugfs: update blk_queue_flag_name[] accordingly for new flags Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 09/16] m68k: nommu: register start of the memory with memblock Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 10/16] m68k: mm: fix node memblock init Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 11/16] dt-bindings: mailbox: zynqmp_ipi: fix unit address Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 12/16] cifs: prevent truncation from long to int in wait_for_free_credits Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 13/16] arm64/alternatives: use subsections for replacement sequences Sasha Levin
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 14/16] tpm_tis: extra chip->ops check on error path in tpm_tis_core_init Sasha Levin
2020-07-08 15:41 ` Sasha Levin [this message]
2020-07-08 15:41 ` [PATCH AUTOSEL 5.4 16/16] i2c: eg20t: Load module automatically if ID matches Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200708154135.3199907-15-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=cluster-devel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rpeterso@redhat.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).