diff mbox series

[RFC] ceph: skip existing superblocks that are blocklisted when mounting

Message ID 20210930124238.12966-1-jlayton@kernel.org (mailing list archive)
State New, archived
Headers show
Series [RFC] ceph: skip existing superblocks that are blocklisted when mounting | expand

Commit Message

Jeff Layton Sept. 30, 2021, 12:42 p.m. UTC
Currently when mounting, we may end up finding an existing superblock
that corresponds to a blocklisted MDS client. This means that the new
mount ends up being unusable.

If we've found an existing superblock that is already blocklisted, and
the client is not configured to recover on its own, fail the match.

Cc: Patrick Donnelly <pdonnell@redhat.com>
Cc: Niels de Vos <ndevos@redhat.com>
URL: https://bugzilla.redhat.com/show_bug.cgi?id=1901499
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/ceph/super.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index f517ad9eeb26..6e0d670a7f34 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -1124,6 +1124,7 @@  static int ceph_compare_super(struct super_block *sb, struct fs_context *fc)
 	struct ceph_mount_options *fsopt = new->mount_options;
 	struct ceph_options *opt = new->client->options;
 	struct ceph_fs_client *other = ceph_sb_to_client(sb);
+	struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(sb);
 
 	dout("ceph_compare_super %p\n", sb);
 
@@ -1140,6 +1141,12 @@  static int ceph_compare_super(struct super_block *sb, struct fs_context *fc)
 		dout("flags differ\n");
 		return 0;
 	}
+
+	/* Exclude any blocklisted superblocks */
+	if (mdsc->blocklisted && !(fsopt->flags & CEPH_MOUNT_OPT_CLEANRECOVER)) {
+		dout("mds client is blocklisted (and CLEANRECOVER is not set)\n");
+		return 0;
+	}
 	return 1;
 }