From: Xiubo Li Date: Thu, 12 Nov 2020 01:13:45 +0000 (+0800) Subject: client: do not use g_conf().get_val<>() in libcephfs X-Git-Tag: v14.2.17~109^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F38467%2Fhead;p=ceph.git client: do not use g_conf().get_val<>() in libcephfs 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 (cherry picked from commit a467274f1c4dcf357de48fb736d40f7488bc4d7c) --- diff --git a/src/client/Client.cc b/src/client/Client.cc index af6633741228..4b63a0082a30 100755 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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("mds_max_retries_on_remount_failure"); + uint64_t max_retries = cct->_conf.get_val("mds_max_retries_on_remount_failure"); errno = 0; int r = remount_cb(callback_handle); diff --git a/src/client/fuse_ll.cc b/src/client/fuse_ll.cc index 9a305fb14051..74980a02fa20 100644 --- a/src/client/fuse_ll.cc +++ b/src/client/fuse_ll.cc @@ -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("fuse_set_user_groups")) { + CephFuse::Handle *cfuse = (CephFuse::Handle *)fuse_req_userdata(req); + if (cfuse->client->cct->_conf.get_val("fuse_set_user_groups")) { gid_t *gids = NULL; int count = getgroups(req, &gids);