]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: do not use g_conf().get_val<>() in libcephfs 38467/head
authorXiubo Li <xiubli@redhat.com>
Thu, 12 Nov 2020 01:13:45 +0000 (09:13 +0800)
committerVicente Cheng <freeze.bilsted@gmail.com>
Mon, 7 Dec 2020 08:46:28 +0000 (08:46 +0000)
The g_conf() will try to dereference the "g_ceph_context" to get
the "_conf", but the "g_ceph_context" won't be set in none fuse
use case in libcephfs, so it will crash in when doing
g_conf().get_val<>.

Switch to use cct->_conf.get_val<> instead.

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

src/client/Client.cc
src/client/fuse_ll.cc

index af66337412288b728d52438cadc90dca031bd0e9..4b63a0082a3008a3323097280063c182a9dd5d81 100755 (executable)
@@ -4177,7 +4177,7 @@ void Client::remove_session_caps(MetaSession *s)
 
 int Client::_do_remount(bool retry_on_error)
 {
-  uint64_t max_retries = g_conf().get_val<uint64_t>("mds_max_retries_on_remount_failure");
+  uint64_t max_retries = cct->_conf.get_val<uint64_t>("mds_max_retries_on_remount_failure");
 
   errno = 0;
   int r = remount_cb(callback_handle);
index 9a305fb14051e914038d5f46fa4a3ec8681de2ba..74980a02fa20ab0a82d8203a757d6a467762917a 100644 (file)
@@ -135,7 +135,8 @@ static int getgroups(fuse_req_t req, gid_t **sgids)
 
 static void get_fuse_groups(UserPerm& perms, fuse_req_t req)
 {
-  if (g_conf().get_val<bool>("fuse_set_user_groups")) {
+  CephFuse::Handle *cfuse = (CephFuse::Handle *)fuse_req_userdata(req);
+  if (cfuse->client->cct->_conf.get_val<bool>("fuse_set_user_groups")) {
     gid_t *gids = NULL;
     int count = getgroups(req, &gids);