stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] ceph: skip existing superblocks that are blocklisted or shut down when mounting
@ 2021-10-12 13:49 Jeff Layton
  2021-10-12 19:05 ` Ilya Dryomov
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Layton @ 2021-10-12 13:49 UTC (permalink / raw)
  To: ceph-devel
  Cc: idryomov, Patrick Donnelly, Niels de Vos, Yan, Zheng, stable, Xiubo Li

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 with a client that is already
blocklisted, and the client is not configured to recover on its own,
fail the match. Ditto if the superblock has been forcibly unmounted.

While we're in here, also rename "other" to the more conventional "fsc".

Cc: Patrick Donnelly <pdonnell@redhat.com>
Cc: Niels de Vos <ndevos@redhat.com>
Cc: "Yan, Zheng" <ukernel@gmail.com>
Cc: stable@vger.kernel.org
URL: https://bugzilla.redhat.com/show_bug.cgi?id=1901499
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>

ceph: when comparing superblocks, skip ones that have been forcibly unmounted

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/ceph/super.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

v3: also handle the case where we have a forcibly unmounted superblock
    that is detached but still extant

diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index f517ad9eeb26..b9ba50c9dc95 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -1123,16 +1123,16 @@ static int ceph_compare_super(struct super_block *sb, struct fs_context *fc)
 	struct ceph_fs_client *new = fc->s_fs_info;
 	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_fs_client *fsc = ceph_sb_to_client(sb);
 
 	dout("ceph_compare_super %p\n", sb);
 
-	if (compare_mount_options(fsopt, opt, other)) {
+	if (compare_mount_options(fsopt, opt, fsc)) {
 		dout("monitor(s)/mount options don't match\n");
 		return 0;
 	}
 	if ((opt->flags & CEPH_OPT_FSID) &&
-	    ceph_fsid_compare(&opt->fsid, &other->client->fsid)) {
+	    ceph_fsid_compare(&opt->fsid, &fsc->client->fsid)) {
 		dout("fsid doesn't match\n");
 		return 0;
 	}
@@ -1140,6 +1140,17 @@ static int ceph_compare_super(struct super_block *sb, struct fs_context *fc)
 		dout("flags differ\n");
 		return 0;
 	}
+	/* Exclude any blocklisted superblocks */
+	if (fsc->blocklisted && !ceph_test_mount_opt(fsc, CLEANRECOVER)) {
+		dout("client is blocklisted (and CLEANRECOVER is not set)\n");
+		return 0;
+	}
+
+	if (fsc->mount_state == CEPH_MOUNT_SHUTDOWN) {
+		dout("client has been forcibly unmounted\n");
+		return 0;
+	}
+
 	return 1;
 }
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] ceph: skip existing superblocks that are blocklisted or shut down when mounting
  2021-10-12 13:49 [PATCH v3] ceph: skip existing superblocks that are blocklisted or shut down when mounting Jeff Layton
@ 2021-10-12 19:05 ` Ilya Dryomov
  2021-10-12 19:42   ` Jeff Layton
  0 siblings, 1 reply; 4+ messages in thread
From: Ilya Dryomov @ 2021-10-12 19:05 UTC (permalink / raw)
  To: Jeff Layton
  Cc: Ceph Development, Patrick Donnelly, Niels de Vos, Yan, Zheng,
	stable, Xiubo Li

On Tue, Oct 12, 2021 at 3:49 PM Jeff Layton <jlayton@kernel.org> wrote:
>
> 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 with a client that is already
> blocklisted, and the client is not configured to recover on its own,
> fail the match. Ditto if the superblock has been forcibly unmounted.
>
> While we're in here, also rename "other" to the more conventional "fsc".
>
> Cc: Patrick Donnelly <pdonnell@redhat.com>
> Cc: Niels de Vos <ndevos@redhat.com>
> Cc: "Yan, Zheng" <ukernel@gmail.com>
> Cc: stable@vger.kernel.org
> URL: https://bugzilla.redhat.com/show_bug.cgi?id=1901499
> Reviewed-by: Xiubo Li <xiubli@redhat.com>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
>
> ceph: when comparing superblocks, skip ones that have been forcibly unmounted
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>

Hi Jeff,

This looks like a squashing left-over.

> ---
>  fs/ceph/super.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
>
> v3: also handle the case where we have a forcibly unmounted superblock
>     that is detached but still extant
>
> diff --git a/fs/ceph/super.c b/fs/ceph/super.c
> index f517ad9eeb26..b9ba50c9dc95 100644
> --- a/fs/ceph/super.c
> +++ b/fs/ceph/super.c
> @@ -1123,16 +1123,16 @@ static int ceph_compare_super(struct super_block *sb, struct fs_context *fc)
>         struct ceph_fs_client *new = fc->s_fs_info;
>         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_fs_client *fsc = ceph_sb_to_client(sb);
>
>         dout("ceph_compare_super %p\n", sb);
>
> -       if (compare_mount_options(fsopt, opt, other)) {
> +       if (compare_mount_options(fsopt, opt, fsc)) {
>                 dout("monitor(s)/mount options don't match\n");
>                 return 0;
>         }
>         if ((opt->flags & CEPH_OPT_FSID) &&
> -           ceph_fsid_compare(&opt->fsid, &other->client->fsid)) {
> +           ceph_fsid_compare(&opt->fsid, &fsc->client->fsid)) {
>                 dout("fsid doesn't match\n");
>                 return 0;
>         }
> @@ -1140,6 +1140,17 @@ static int ceph_compare_super(struct super_block *sb, struct fs_context *fc)
>                 dout("flags differ\n");
>                 return 0;
>         }
> +       /* Exclude any blocklisted superblocks */

Nit: given the dout message that follows, this comment seems useless.

Thanks,

                Ilya

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] ceph: skip existing superblocks that are blocklisted or shut down when mounting
  2021-10-12 19:05 ` Ilya Dryomov
@ 2021-10-12 19:42   ` Jeff Layton
  2021-10-12 20:05     ` Ilya Dryomov
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Layton @ 2021-10-12 19:42 UTC (permalink / raw)
  To: Ilya Dryomov
  Cc: Ceph Development, Patrick Donnelly, Niels de Vos, Yan, Zheng,
	stable, Xiubo Li

On Tue, 2021-10-12 at 21:05 +0200, Ilya Dryomov wrote:
> On Tue, Oct 12, 2021 at 3:49 PM Jeff Layton <jlayton@kernel.org> wrote:
> > 
> > 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 with a client that is already
> > blocklisted, and the client is not configured to recover on its own,
> > fail the match. Ditto if the superblock has been forcibly unmounted.
> > 
> > While we're in here, also rename "other" to the more conventional "fsc".
> > 
> > Cc: Patrick Donnelly <pdonnell@redhat.com>
> > Cc: Niels de Vos <ndevos@redhat.com>
> > Cc: "Yan, Zheng" <ukernel@gmail.com>
> > Cc: stable@vger.kernel.org
> > URL: https://bugzilla.redhat.com/show_bug.cgi?id=1901499
> > Reviewed-by: Xiubo Li <xiubli@redhat.com>
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > 
> > ceph: when comparing superblocks, skip ones that have been forcibly unmounted
> > 
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> 
> Hi Jeff,
> 
> This looks like a squashing left-over.
> 

Yep, that can be removed.

> > ---
> >  fs/ceph/super.c | 17 ++++++++++++++---
> >  1 file changed, 14 insertions(+), 3 deletions(-)
> > 
> > v3: also handle the case where we have a forcibly unmounted superblock
> >     that is detached but still extant
> > 
> > diff --git a/fs/ceph/super.c b/fs/ceph/super.c
> > index f517ad9eeb26..b9ba50c9dc95 100644
> > --- a/fs/ceph/super.c
> > +++ b/fs/ceph/super.c
> > @@ -1123,16 +1123,16 @@ static int ceph_compare_super(struct super_block *sb, struct fs_context *fc)
> >         struct ceph_fs_client *new = fc->s_fs_info;
> >         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_fs_client *fsc = ceph_sb_to_client(sb);
> > 
> >         dout("ceph_compare_super %p\n", sb);
> > 
> > -       if (compare_mount_options(fsopt, opt, other)) {
> > +       if (compare_mount_options(fsopt, opt, fsc)) {
> >                 dout("monitor(s)/mount options don't match\n");
> >                 return 0;
> >         }
> >         if ((opt->flags & CEPH_OPT_FSID) &&
> > -           ceph_fsid_compare(&opt->fsid, &other->client->fsid)) {
> > +           ceph_fsid_compare(&opt->fsid, &fsc->client->fsid)) {
> >                 dout("fsid doesn't match\n");
> >                 return 0;
> >         }
> > @@ -1140,6 +1140,17 @@ static int ceph_compare_super(struct super_block *sb, struct fs_context *fc)
> >                 dout("flags differ\n");
> >                 return 0;
> >         }
> > +       /* Exclude any blocklisted superblocks */
> 
> Nit: given the dout message that follows, this comment seems useless.
> 
> Thanks,
> 
>                 Ilya

I'm fine with removing that comment. Would you rather I resend, or do
you just want to fix up the nits in-tree?

Thanks,
-- 
Jeff Layton <jlayton@kernel.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] ceph: skip existing superblocks that are blocklisted or shut down when mounting
  2021-10-12 19:42   ` Jeff Layton
@ 2021-10-12 20:05     ` Ilya Dryomov
  0 siblings, 0 replies; 4+ messages in thread
From: Ilya Dryomov @ 2021-10-12 20:05 UTC (permalink / raw)
  To: Jeff Layton
  Cc: Ceph Development, Patrick Donnelly, Niels de Vos, Yan, Zheng,
	stable, Xiubo Li

On Tue, Oct 12, 2021 at 9:42 PM Jeff Layton <jlayton@kernel.org> wrote:
>
> On Tue, 2021-10-12 at 21:05 +0200, Ilya Dryomov wrote:
> > On Tue, Oct 12, 2021 at 3:49 PM Jeff Layton <jlayton@kernel.org> wrote:
> > >
> > > 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 with a client that is already
> > > blocklisted, and the client is not configured to recover on its own,
> > > fail the match. Ditto if the superblock has been forcibly unmounted.
> > >
> > > While we're in here, also rename "other" to the more conventional "fsc".
> > >
> > > Cc: Patrick Donnelly <pdonnell@redhat.com>
> > > Cc: Niels de Vos <ndevos@redhat.com>
> > > Cc: "Yan, Zheng" <ukernel@gmail.com>
> > > Cc: stable@vger.kernel.org
> > > URL: https://bugzilla.redhat.com/show_bug.cgi?id=1901499
> > > Reviewed-by: Xiubo Li <xiubli@redhat.com>
> > > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > >
> > > ceph: when comparing superblocks, skip ones that have been forcibly unmounted
> > >
> > > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> >
> > Hi Jeff,
> >
> > This looks like a squashing left-over.
> >
>
> Yep, that can be removed.
>
> > > ---
> > >  fs/ceph/super.c | 17 ++++++++++++++---
> > >  1 file changed, 14 insertions(+), 3 deletions(-)
> > >
> > > v3: also handle the case where we have a forcibly unmounted superblock
> > >     that is detached but still extant
> > >
> > > diff --git a/fs/ceph/super.c b/fs/ceph/super.c
> > > index f517ad9eeb26..b9ba50c9dc95 100644
> > > --- a/fs/ceph/super.c
> > > +++ b/fs/ceph/super.c
> > > @@ -1123,16 +1123,16 @@ static int ceph_compare_super(struct super_block *sb, struct fs_context *fc)
> > >         struct ceph_fs_client *new = fc->s_fs_info;
> > >         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_fs_client *fsc = ceph_sb_to_client(sb);
> > >
> > >         dout("ceph_compare_super %p\n", sb);
> > >
> > > -       if (compare_mount_options(fsopt, opt, other)) {
> > > +       if (compare_mount_options(fsopt, opt, fsc)) {
> > >                 dout("monitor(s)/mount options don't match\n");
> > >                 return 0;
> > >         }
> > >         if ((opt->flags & CEPH_OPT_FSID) &&
> > > -           ceph_fsid_compare(&opt->fsid, &other->client->fsid)) {
> > > +           ceph_fsid_compare(&opt->fsid, &fsc->client->fsid)) {
> > >                 dout("fsid doesn't match\n");
> > >                 return 0;
> > >         }
> > > @@ -1140,6 +1140,17 @@ static int ceph_compare_super(struct super_block *sb, struct fs_context *fc)
> > >                 dout("flags differ\n");
> > >                 return 0;
> > >         }
> > > +       /* Exclude any blocklisted superblocks */
> >
> > Nit: given the dout message that follows, this comment seems useless.
> >
> > Thanks,
> >
> >                 Ilya
>
> I'm fine with removing that comment. Would you rather I resend, or do
> you just want to fix up the nits in-tree?

The squashing left-over is already fixed.  I'll remove the comment
later.

Thanks,

                Ilya

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-12 20:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12 13:49 [PATCH v3] ceph: skip existing superblocks that are blocklisted or shut down when mounting Jeff Layton
2021-10-12 19:05 ` Ilya Dryomov
2021-10-12 19:42   ` Jeff Layton
2021-10-12 20:05     ` Ilya Dryomov

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).