diff options
| author | Patrick Donnelly <pdonnell@redhat.com> | 2024-10-12 20:54:11 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-12-09 10:33:06 +0100 |
| commit | 308e0cc36dc409718db0bf55e57c9867367183c4 (patch) | |
| tree | 8f898768bc12debf69fb0a5769d26db06c443eab | |
| parent | 33a213c04faff6c3a7fe77e947db81bc7270fe32 (diff) | |
| download | linux-308e0cc36dc409718db0bf55e57c9867367183c4.tar.gz linux-308e0cc36dc409718db0bf55e57c9867367183c4.tar.bz2 linux-308e0cc36dc409718db0bf55e57c9867367183c4.zip | |
ceph: extract entity name from device id
commit 955710afcb3bb63e21e186451ed5eba85fa14d0b upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | fs/ceph/super.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index ec51e398562c..4f51a2e74d07 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -281,7 +281,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 != '=') { @@ -292,8 +294,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"); |
