From: Xiubo Li Date: Fri, 13 Nov 2020 08:08:31 +0000 (+0800) Subject: global: reexpand the conf meta in all the child processes X-Git-Tag: v16.1.0~458^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=73a48dfe8ed165cb6c8295a88f133acb30e7065e;p=ceph.git global: reexpand the conf meta in all the child processes Especially for the tools or the daemons whose config options need to expand the '$pid', they will be always expanded with the parent processes. We need to reexpand them in child processes just after the fork is done. Fixes: https://tracker.ceph.com/issues/48240 Signed-off-by: Xiubo Li --- diff --git a/PendingReleaseNotes b/PendingReleaseNotes index 4684d9d03d3..ddf39e300b6 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -1,5 +1,9 @@ >=16.0.0 -------- +* $pid expansion in config paths like `admin_socket` will now properly expand + to the daemon pid for commands like `ceph-mds` or `ceph-osd`. Previously only + `ceph-fuse`/`rbd-nbd` expanded `$pid` with the actual daemon pid. + * The allowable options for some "radosgw-admin" commands have been changed. * "mdlog-list", "datalog-list", "sync-error-list" no longer accepts diff --git a/src/ceph_fuse.cc b/src/ceph_fuse.cc index 1529ec2322e..b7f8a4d4b90 100644 --- a/src/ceph_fuse.cc +++ b/src/ceph_fuse.cc @@ -179,9 +179,8 @@ int main(int argc, const char **argv, const char *envp[]) { } { - g_ceph_context->_conf.finalize_reexpand_meta(); common_init_finish(g_ceph_context); - + init_async_signal_handler(); register_async_signal_handler(SIGHUP, sighup_handler); diff --git a/src/global/global_init.cc b/src/global/global_init.cc index 3387a0e55bd..32e36d45fe7 100644 --- a/src/global/global_init.cc +++ b/src/global/global_init.cc @@ -515,6 +515,9 @@ int reopen_as_null(CephContext *cct, int fd) void global_init_postfork_start(CephContext *cct) { + // reexpand the meta in child process + cct->_conf.finalize_reexpand_meta(); + // restart log thread cct->_log->start(); cct->notify_post_fork(); diff --git a/src/tools/rbd_nbd/rbd-nbd.cc b/src/tools/rbd_nbd/rbd-nbd.cc index 11ccdf0e4b4..d2e11405f8d 100644 --- a/src/tools/rbd_nbd/rbd-nbd.cc +++ b/src/tools/rbd_nbd/rbd-nbd.cc @@ -1594,7 +1594,6 @@ static int do_map(int argc, const char *argv[], Config *cfg, bool reconnect) global_init_postfork_start(g_ceph_context); } - g_ceph_context->_conf.finalize_reexpand_meta(); common_init_finish(g_ceph_context); global_init_chdir(g_ceph_context);