]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: do not use g_conf().get_val<>() in libcephfs 38033/head
authorXiubo Li <xiubli@redhat.com>
Thu, 12 Nov 2020 01:13:45 +0000 (09:13 +0800)
committerXiubo Li <xiubli@redhat.com>
Fri, 20 Nov 2020 09:55:51 +0000 (17:55 +0800)
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>
src/client/Client.cc
src/client/fuse_ll.cc

index aaf9db20c35423a2a1496616a5a3f845c18541ab..2a5cb7714334f29a219a9dab58815ab02bb17873 100644 (file)
@@ -4329,7 +4329,7 @@ void Client::remove_session_caps(MetaSession *s, int err)
 
 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 82c152ad56fd80eec891783482555078ad654cd7..e43f1537975554c725a6315a2d15d96b5dc6321d 100644 (file)
@@ -136,7 +136,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);