From: Jeff Layton Date: Tue, 4 Jan 2022 15:13:31 +0000 (-0500) Subject: mount.ceph: fix the handling of new-syntax device names X-Git-Tag: v17.1.0~104^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=c8c341860fcef7a3fa4c73dbe6c6c8037693891c;p=ceph-ci.git mount.ceph: fix the handling of new-syntax device names 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 --- diff --git a/src/mount/mount.ceph.c b/src/mount/mount.ceph.c index 14b979e12b1..43c2cdccb7a 100644 --- a/src/mount/mount.ceph.c +++ b/src/mount/mount.ceph.c @@ -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 */