Skip to content

Commit 955710a

Browse files
batrickidryomov
authored andcommitted
ceph: extract entity name from device id
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] Link: https://tracker.ceph.com/issues/68516 Signed-off-by: Patrick Donnelly <[email protected]> Reviewed-by: Ilya Dryomov <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent 6779c9d commit 955710a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

fs/ceph/super.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,9 @@ static int ceph_parse_new_source(const char *dev_name, const char *dev_name_end,
285285
size_t len;
286286
struct ceph_fsid fsid;
287287
struct ceph_parse_opts_ctx *pctx = fc->fs_private;
288+
struct ceph_options *opts = pctx->copts;
288289
struct ceph_mount_options *fsopt = pctx->opts;
290+
const char *name_start = dev_name;
289291
char *fsid_start, *fs_name_start;
290292

291293
if (*dev_name_end != '=') {
@@ -296,8 +298,14 @@ static int ceph_parse_new_source(const char *dev_name, const char *dev_name_end,
296298
fsid_start = strchr(dev_name, '@');
297299
if (!fsid_start)
298300
return invalfc(fc, "missing cluster fsid");
299-
++fsid_start; /* start of cluster fsid */
301+
len = fsid_start - name_start;
302+
kfree(opts->name);
303+
opts->name = kstrndup(name_start, len, GFP_KERNEL);
304+
if (!opts->name)
305+
return -ENOMEM;
306+
dout("using %s entity name", opts->name);
300307

308+
++fsid_start; /* start of cluster fsid */
301309
fs_name_start = strchr(fsid_start, '.');
302310
if (!fs_name_start)
303311
return invalfc(fc, "missing file system name");

0 commit comments

Comments
 (0)