]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mount: fix mount failure with old kernels 49404/head
authorXiubo Li <xiubli@redhat.com>
Mon, 14 Nov 2022 10:11:39 +0000 (18:11 +0800)
committerXiubo Li <xiubli@redhat.com>
Thu, 16 Feb 2023 23:57:12 +0000 (07:57 +0800)
If the 'cmi->cmi_opts' has only one option and there is no any
comma in it, when removing the 'mon_addr' it will fail. And will
pass the 'mon_addr' option to the old kernels.

Fixes: https://tracker.ceph.com/issues/58018
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 3180332ec48596794e2ff4fff305119c4ec2caf7)

src/mount/mount.ceph.c

index 032c22e6c23f00c09f3122f42d7fca518a1c65de..ff1b12c474e57772e7530d6923e0e05356e33a24 100644 (file)
@@ -164,7 +164,9 @@ static int remove_opt(struct ceph_mount_info *cmi, const char *key, char **value
                memmove(key_start, value_end, len2);
        } else {
                 /* last kv pair - swallow the comma */
-               --key_start;
+               if (*(key_start - 1) == ',') {
+                       --key_start;
+               }
                *key_start = '\0';
        }