From c6c99d2693925d8556638e291c87a7d305dcf7b4 Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Thu, 12 Nov 2020 09:13:45 +0800 Subject: [PATCH] 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) --- src/client/Client.cc | 2 +- src/client/fuse_ll.cc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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); -- 2.47.3