Skip to content

Commit

Permalink
ceph: extract entity name from device id
Browse files Browse the repository at this point in the history
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: stable@vger.kernel.org
Link: https://tracker.ceph.com/issues/68516
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
  • Loading branch information
Patrick Donnelly authored and Ilya Dryomov committed Nov 18, 2024
1 parent 6779c9d commit 955710a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion fs/ceph/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
char *fsid_start, *fs_name_start;

if (*dev_name_end != '=') {
Expand All @@ -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");
Expand Down

0 comments on commit 955710a

Please sign in to comment.