Skip to contentSkip to conversation

ceph: use entity name from new device string

PATCH In review Patrick Donnelly 2 participants 4 messages Oct 14, 2024 – Nov 18, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover ceph: use entity name from new device string

From: Patrick Donnelly <[email protected]>

Respinning this because the last series accidentally included patches from another set.

Patrick Donnelly (2):
ceph: requalify some char pointers as const
ceph: extract entity name from device id

 fs/ceph/super.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

base-commit: 7234e2ea0edd00bfb6bb2159e55878c19885ce68

Signature · 5 lines
Patrick Donnelly, Ph.D.
He / Him / His
Red Hat Partner Engineer
IBM, Inc.
GPG: 19F28A586F808C2402351B93C3301A3E258DD79D
#1 lore raw

PATCH 1/2 ceph: requalify some char pointers as const

From: Patrick Donnelly <[email protected]>

---
 fs/ceph/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/super.c +1 -1
index 73f321b52895..42bdbe5b7ef9 100644
@@ -286,7 +286,7 @@ static int ceph_parse_new_source(const char *dev_name, const char *dev_name_end,
 	struct ceph_fsid fsid;
 	struct ceph_parse_opts_ctx *pctx = fc->fs_private;
 	struct ceph_mount_options *fsopt = pctx->opts;
-	char *fsid_start, *fs_name_start;
+	const char *fsid_start, *fs_name_start;
 
 	if (*dev_name_end != '=') {
 		dout("separator '=' missing in source");
Signature · 5 lines
Patrick Donnelly, Ph.D.
He / Him / His
Red Hat Partner Engineer
IBM, Inc.
GPG: 19F28A586F808C2402351B93C3301A3E258DD79D
#2 lore raw

PATCH 2/2 ceph: extract entity name from device id

In reply to Patrick Donnelly

From: Patrick Donnelly <[email protected]>

Previously, the "name" in the new device syntax "<name>@<fsid>.<fsname>" was ignored because (presumably) tests were done using mount.ceph which also passed the entity name using "-o name=foo". If mounting is done without the mount.ceph helper, the new device id syntax fails to set the name properly.

Cc: [email protected]
Resolves: https://tracker.ceph.com/issues/68516

---
 fs/ceph/super.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
fs/ceph/super.c +9 -1
index 42bdbe5b7ef9..de03cd6eb86e 100644
@@ -285,7 +285,9 @@ static int ceph_parse_new_source(const char *dev_name, const char *dev_name_end,
 	size_t len;
 	struct ceph_fsid fsid;
 	struct ceph_parse_opts_ctx *pctx = fc->fs_private;
+	struct ceph_options *opts = pctx->copts;
 	struct ceph_mount_options *fsopt = pctx->opts;
+	const char *name_start = dev_name;
 	const char *fsid_start, *fs_name_start;
 
 	if (*dev_name_end != '=') {
@@ -296,8 +298,14 @@ static int ceph_parse_new_source(const char *dev_name, const char *dev_name_end,
 	fsid_start = strchr(dev_name, '@');
 	if (!fsid_start)
 		return invalfc(fc, "missing cluster fsid");
-	++fsid_start; /* start of cluster fsid */
+	len = fsid_start - name_start;
+	kfree(opts->name);
+	opts->name = kstrndup(name_start, len, GFP_KERNEL);
+	if (!opts->name)
+		return -ENOMEM;
+	dout("using %s entity name", opts->name);
 
+	++fsid_start; /* start of cluster fsid */
 	fs_name_start = strchr(fsid_start, '.');
 	if (!fs_name_start)
 		return invalfc(fc, "missing file system name");
Signature · 5 lines
Patrick Donnelly, Ph.D.
He / Him / His
Red Hat Partner Engineer
IBM, Inc.
GPG: 19F28A586F808C2402351B93C3301A3E258DD79D
maintainer
#3 lore raw
In reply to Patrick Donnelly
Quoted 9 lines · Patrick Donnelly

From: Patrick Donnelly <[email protected]>

Respinning this because the last series accidentally included patches from another set.

Patrick Donnelly (2):
ceph: requalify some char pointers as const
ceph: extract entity name from device id

Hi Patrick,

Since the fix (the second patch) is marked for stable, I reordered these so that the first patch which just tacks on const doesn't get in the way when backporting the fix.

Thanks,

Ilya