]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mount.ceph: fix the handling of new-syntax device names
authorJeff Layton <jlayton@redhat.com>
Tue, 4 Jan 2022 15:13:31 +0000 (10:13 -0500)
committerJeff Layton <jlayton@redhat.com>
Tue, 4 Jan 2022 16:25:03 +0000 (11:25 -0500)
With the new mount device syntax, the mount helper will end up
prepending "client." to whatever device string is passed down. If you
then go to recreate that mount later from the info in /proc/mounts,
you'll end up getting back an error because it'll try to prepend
"client." again.

There is no reason to send a fully-qualified principal name down to the
kernel since it can only use client.* principals anyway. Fix the mount
helper to track the unqualified name internally and only fully-qualify
it when we're scraping the config for info.

Fixes: https://tracker.ceph.com/issues/53765
Signed-off-by: Jeff Layton <jlayton@redhat.com>
src/mount/mount.ceph.c

index 14b979e12b125d652b18c64f2dc8e1c32ae1684e..43c2cdccb7a9ef23ec370cfb5d04fbb36eaab1c8 100644 (file)
@@ -176,7 +176,6 @@ static void record_name(const char *name, struct ceph_mount_info *cmi)
        int name_pos = 0;
        int name_len = 0;
 
-       name_pos = safe_cat(&cmi->cmi_name, &name_len, name_pos, "client.");
        name_pos = safe_cat(&cmi->cmi_name, &name_len, name_pos, name);
 }
 
@@ -394,11 +393,19 @@ static int fetch_config_info(struct ceph_mount_info *cmi)
        }
 
        if (pid == 0) {
+               char *entity_name = NULL;
+               int name_pos = 0;
+               int name_len = 0;
+
                /* child */
                ret = drop_capabilities();
                if (ret)
                        exit(1);
-               mount_ceph_get_config_info(cmi->cmi_conf, cmi->cmi_name, v2_addrs, cci);
+
+               name_pos = safe_cat(&entity_name, &name_len, name_pos, "client.");
+               name_pos = safe_cat(&entity_name, &name_len, name_pos, cmi->cmi_name);
+               mount_ceph_get_config_info(cmi->cmi_conf, entity_name, v2_addrs, cci);
+               free(entity_name);
                exit(0);
        } else {
                /* parent */