From: Luis Henriques Date: Thu, 16 May 2019 10:50:56 +0000 (+0100) Subject: common/secret.c: fix key parsing when doing a remount X-Git-Tag: v14.2.2~34^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ef264d9b385759dc229a49d9c65f78039b2f8eaf;p=ceph.git common/secret.c: fix key parsing when doing a remount When doing a CephFS remount (-o remount) the secret is parsed from procfs and we get '' as a result and the mount will fail with: secret is not valid base64: Invalid argument. adding ceph secret key to kernel failed: Invalid argument. As the kernel already have the key, we simply need to use it. Fixes: https://tracker.ceph.com/issues/39951 Signed-off-by: Luis Henriques (cherry picked from commit f44516bcde8d48ef5dca4f92017d1e241eb8e26e) --- diff --git a/src/common/secret.c b/src/common/secret.c index b6f26ec3ece5..8f92fb0a7f01 100644 --- a/src/common/secret.c +++ b/src/common/secret.c @@ -101,8 +101,8 @@ int get_secret_option(const char *secret, const char *key_name, option[olen] = '\0'; - - if (secret) { + /* when parsing kernel options (-o remount) we get '' as the secret */ + if (secret && (strcmp(secret, "") != 0)) { ret = set_kernel_secret(secret, key_name); if (ret < 0) { if (ret == -ENODEV || ret == -ENOSYS) {