]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mount: fix mount failure with old kernels 48873/head
authorXiubo Li <xiubli@redhat.com>
Mon, 14 Nov 2022 10:11:39 +0000 (18:11 +0800)
committerXiubo Li <xiubli@redhat.com>
Mon, 14 Nov 2022 13:54:20 +0000 (21:54 +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>
src/mount/mount.ceph.c

index 1aeac83dcc3459900dc6e9b3efabcf6385bb45e3..631b0b3fcf18de215bdd9ba9c71a40476adf29f4 100644 (file)
@@ -166,7 +166,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';
        }