Re: [PATCH v2 2/4] ceph: validate cluster FSID for new device syntax

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 02, 2021 at 11:44:05AM +0100, Luis Henriques wrote:
> On Fri, Jul 02, 2021 at 12:18:19PM +0530, Venky Shankar wrote:
> > The new device syntax requires the cluster FSID as part
> > of the device string. Use this FSID to verify if it matches
> > the cluster FSID we get back from the monitor, failing the
> > mount on mismatch.
> > 
> > Also, rename parse_fsid() to ceph_parse_fsid() as it is too
> > generic.
> > 
> > Signed-off-by: Venky Shankar <vshankar@xxxxxxxxxx>
> > ---
> >  fs/ceph/super.c              | 9 +++++++++
> >  fs/ceph/super.h              | 1 +
> >  include/linux/ceph/libceph.h | 1 +
> >  net/ceph/ceph_common.c       | 5 +++--
> >  4 files changed, 14 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/ceph/super.c b/fs/ceph/super.c
> > index 0b324e43c9f4..03e5f4bb2b6f 100644
> > --- a/fs/ceph/super.c
> > +++ b/fs/ceph/super.c
> > @@ -268,6 +268,9 @@ static int ceph_parse_new_source(const char *dev_name, const char *dev_name_end,
> >  	if (!fs_name_start)
> >  		return invalfc(fc, "missing file system name");
> >  
> > +	if (ceph_parse_fsid(fsid_start, &fsopt->fsid))
> > +		return invalfc(fc, "invalid fsid format");
> > +
> >  	++fs_name_start; /* start of file system name */
> >  	fsopt->mds_namespace = kstrndup(fs_name_start,
> >  					dev_name_end - fs_name_start, GFP_KERNEL);
> > @@ -750,6 +753,12 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt,
> >  	}
> >  	opt = NULL; /* fsc->client now owns this */
> >  
> > +	/* help learn fsid */
> > +	if (fsopt->new_dev_syntax) {
> > +		ceph_check_fsid(fsc->client, &fsopt->fsid);
> 
> This call to ceph_check_fsid() made me wonder what would happen if I use
> the wrong fsid with the new syntax.  And the result is:
> 
> [   41.882334] libceph: mon0 (1)192.168.155.1:40594 session established
> [   41.884537] libceph: bad fsid, had d52783e6-efc2-4dce-ad01-aa3272fa5f66 got 90bdb539-9d95-402e-8f23-b0e26cba8b1b
> [   41.885955] libceph: bad fsid, had d52783e6-efc2-4dce-ad01-aa3272fa5f66 got 90bdb539-9d95-402e-8f23-b0e26cba8b1b
> [   41.889313] libceph: bad fsid, had d52783e6-efc2-4dce-ad01-aa3272fa5f66 got 90bdb539-9d95-402e-8f23-b0e26cba8b1b
> [   41.892578] libceph: osdc handle_map corrupt msg
> 
> ... followed by a msg dump.
> 
> I guess this means that manually setting the fsid requires changes to the
> messenger (I've only tested with v1) so that it gracefully handles this
> scenario.

I forgot to mention that the above errors are, obviously, not due to this
call to ceph_check_fsid() but rather from calling it from mon_dispatch().

Cheers,
--
Luís



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux