]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mount: record cluster fsid when reading ceph config file
authorVenky Shankar <vshankar@redhat.com>
Thu, 20 May 2021 12:11:05 +0000 (08:11 -0400)
committerVenky Shankar <vshankar@redhat.com>
Tue, 30 Nov 2021 06:13:34 +0000 (01:13 -0500)
This will be required when switching to new mount device
syntax when cluster fsid will be passed to kernel as mount
option.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
src/mount/conf.cc
src/mount/mount.ceph.c
src/mount/mount.ceph.h

index 2eae2b04c168006d818a37dabd22e3ae0737ad1d..df95912c1f3b507230c4f6b07dff098fcb725587 100644 (file)
@@ -46,6 +46,9 @@ extern "C" void mount_ceph_get_config_info(const char *config_file,
   conf.parse_env(cct->get_module_type()); // environment variables override
   conf.apply_changes(nullptr);
 
+  auto fsid = conf.get_val<uuid_d>("fsid");
+  fsid.print(cci->cci_fsid);
+
   ceph::async::io_context_pool ioc(1);
   MonClient monc = MonClient(cct.get(), ioc);
   err = monc.build_initial_monmap();
index 061d51071902df300eac1f8bfbc907fe0a081fcf..8672920bc74396b26e07a55bfc23fc946432b99e 100644 (file)
@@ -133,7 +133,7 @@ static int fetch_config_info(struct ceph_mount_info *cmi)
        struct ceph_config_info *cci;
 
        /* Don't do anything if we already have requisite info */
-       if (cmi->cmi_secret[0] && cmi->cmi_mons)
+       if (cmi->cmi_secret[0] && cmi->cmi_mons && cmi->cmi_fsid)
                return 0;
 
        cci = mmap((void *)0, sizeof(*cci), PROT_READ | PROT_WRITE,
@@ -192,6 +192,11 @@ static int fetch_config_info(struct ceph_mount_info *cmi)
                        if (len < MON_LIST_BUFSIZE)
                                cmi->cmi_mons = strndup(cci->cci_mons, len + 1);
                }
+               if (!cmi->cmi_fsid) {
+                       len = strnlen(cci->cci_fsid, CLUSTER_FSID_LEN);
+                       if (len < CLUSTER_FSID_LEN)
+                               cmi->cmi_fsid = strndup(cci->cci_fsid, len + 1);
+               }
        }
 out:
        munmap(cci, sizeof(*cci));
index 673175db5a8e9f23ec14bde4ad4d3eb93e69d637..9bd6bbfcc07ec10f45f320de2d5eceadded2574f 100644 (file)
@@ -24,11 +24,14 @@ extern "C" {
 /* 2k should be enough for anyone? */
 #define MON_LIST_BUFSIZE       2048
 
+#define CLUSTER_FSID_LEN        37
+
 void mount_ceph_debug(const char *fmt, ...);
 
 struct ceph_config_info {
        char            cci_secret[SECRET_BUFSIZE];     // auth secret
        char            cci_mons[MON_LIST_BUFSIZE];     // monitor addrs
+       char            cci_fsid[CLUSTER_FSID_LEN];     // cluster fsid
 };
 
 void mount_ceph_get_config_info(const char *config_file, const char *name,