summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>2011-05-21 01:35:52 +0200
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>2011-05-21 02:57:11 +0200
commit3a2acefebd5c1626df997f676ed3b61deb8c6c36 (patch)
treeced7ed1cf42cd5031ebad819026ddc24a72006bf /src
parentceph_crypto: add assert_init (diff)
downloadceph-3a2acefebd5c1626df997f676ed3b61deb8c6c36.tar.xz
ceph-3a2acefebd5c1626df997f676ed3b61deb8c6c36.zip
common_init: don't init crypto until after fork
Get rid of the initialize-then-shutdown-crypto hack. We just initialize crypto once, after it is safe to do so. There is now a single callback, common_init_finish, which does the final stage of initialization, including starting crypto and daemonization (if required.) common_init_finish needs to be done before messenger::start(). Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
Diffstat (limited to 'src')
-rw-r--r--src/auth/AuthSupported.cc4
-rw-r--r--src/auth/Crypto.h2
-rw-r--r--src/cauthtool.cc1
-rw-r--r--src/cconf.cc1
-rw-r--r--src/cfuse.cc8
-rw-r--r--src/cmds.cc6
-rw-r--r--src/cmon.cc7
-rw-r--r--src/common/DoutStreambuf.cc6
-rw-r--r--src/common/DoutStreambuf.h2
-rw-r--r--src/common/ceph_crypto.cc12
-rw-r--r--src/common/common_init.cc86
-rw-r--r--src/common/common_init.h8
-rw-r--r--src/common/debug.cc8
-rw-r--r--src/common/debug.h2
-rw-r--r--src/cosd.cc37
-rw-r--r--src/csyn.cc2
-rw-r--r--src/dumpjournal.cc1
-rw-r--r--src/dupstore.cc1
-rw-r--r--src/librados-config.cc1
-rw-r--r--src/monmaptool.cc1
-rw-r--r--src/osdmaptool.cc1
-rw-r--r--src/rados.cc2
-rw-r--r--src/rbd.cc2
-rw-r--r--src/rgw/rgw_admin.cc2
-rw-r--r--src/rgw/rgw_main.cc2
-rw-r--r--src/streamtest.cc2
-rw-r--r--src/test/TestDoutStreambuf.cc1
-rw-r--r--src/test/TestSignalHandlers.cc1
-rw-r--r--src/test/TestTimers.cc1
-rw-r--r--src/test/test_mutate.cc2
-rw-r--r--src/test_trans.cc1
-rw-r--r--src/testmsgr.cc1
-rw-r--r--src/tools/ceph.cc2
-rw-r--r--src/tools/gceph.cc2
34 files changed, 127 insertions, 91 deletions
diff --git a/src/auth/AuthSupported.cc b/src/auth/AuthSupported.cc
index dc14972ca14..9252b5e5aa9 100644
--- a/src/auth/AuthSupported.cc
+++ b/src/auth/AuthSupported.cc
@@ -30,13 +30,11 @@ static void _init_supported(void)
get_str_list(str, sup_list);
for (list<string>::iterator iter = sup_list.begin(); iter != sup_list.end(); ++iter) {
if (iter->compare("cephx") == 0) {
- dout(10) << "supporting cephx auth protocol" << dendl;
auth_supported[CEPH_AUTH_CEPHX] = true;
} else if (iter->compare("none") == 0) {
auth_supported[CEPH_AUTH_NONE] = true;
- dout(10) << "supporting *none* auth protocol" << dendl;
} else {
- dout(0) << "WARNING: unknown auth protocol defined: " << *iter << dendl;
+ derr << "WARNING: unknown auth protocol defined: " << *iter << dendl;
}
}
_supported_initialized = true;
diff --git a/src/auth/Crypto.h b/src/auth/Crypto.h
index 8299c677640..c51a69701ee 100644
--- a/src/auth/Crypto.h
+++ b/src/auth/Crypto.h
@@ -90,7 +90,7 @@ static inline ostream& operator<<(ostream& out, const CryptoKey& k)
* Driver for a particular algorithm
*
* To use these functions, you need to call ceph::crypto::init(), see
- * common/ceph_crypto.h. common_init already does this for you.
+ * common/ceph_crypto.h. common_init_finish does this for you.
*/
class CryptoHandler {
public:
diff --git a/src/cauthtool.cc b/src/cauthtool.cc
index b7ed26d6def..cefe95d5b49 100644
--- a/src/cauthtool.cc
+++ b/src/cauthtool.cc
@@ -55,6 +55,7 @@ int main(int argc, const char **argv)
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY,
CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
+ common_init_finish(&g_conf, 0);
EntityName ename(g_conf.name);
const char *me = argv[0];
diff --git a/src/cconf.cc b/src/cconf.cc
index e8e14b64227..2c9325ef2ea 100644
--- a/src/cconf.cc
+++ b/src/cconf.cc
@@ -122,6 +122,7 @@ int main(int argc, const char **argv)
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
+ common_init_finish(&g_conf, 0);
std::string val;
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
diff --git a/src/cfuse.cc b/src/cfuse.cc
index 2576b400f25..0a8adb9208a 100644
--- a/src/cfuse.cc
+++ b/src/cfuse.cc
@@ -55,7 +55,6 @@ int main(int argc, const char **argv, const char *envp[]) {
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_DAEMON,
CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS);
- keyring_init(&g_conf);
vector<const char*> nargs;
FOR_EACH_ARG(args) {
@@ -109,19 +108,16 @@ int main(int argc, const char **argv, const char *envp[]) {
exit(1);
}
- common_prefork();
childpid = fork();
}
+ common_init_finish(&g_conf, 0);
+
if (childpid == 0) {
//cout << "child, mounting" << std::endl;
::close(fd[0]);
cout << "cfuse[" << getpid() << "]: starting ceph client" << std::endl;
-
- // if we forked, re-init things
- if (g_conf.daemonize)
- common_postfork();
messenger->start_with_nonce(getpid());
// start client
diff --git a/src/cmds.cc b/src/cmds.cc
index 0ad19a4a4ab..0b807ad076d 100644
--- a/src/cmds.cc
+++ b/src/cmds.cc
@@ -66,7 +66,6 @@ int main(int argc, const char **argv)
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_MDS, CODE_ENVIRONMENT_DAEMON, 0);
- keyring_init(&g_conf);
// mds specific args
int shadow = 0;
@@ -163,8 +162,9 @@ int main(int argc, const char **argv)
messenger->set_policy(entity_name_t::TYPE_CLIENT,
SimpleMessenger::Policy::stateful_server(supported, 0));
- if (shadow == MDSMap::STATE_ONESHOT_REPLAY ? false : g_conf.daemonize)
- common_init_daemonize(&g_conf);
+ if (shadow == MDSMap::STATE_ONESHOT_REPLAY)
+ g_conf.daemonize = false;
+ common_init_finish(&g_conf, 0);
messenger->start();
// start mds
diff --git a/src/cmon.cc b/src/cmon.cc
index 7fc742b0ca4..9d1a59b145d 100644
--- a/src/cmon.cc
+++ b/src/cmon.cc
@@ -63,7 +63,6 @@ int main(int argc, const char **argv)
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_MON, CODE_ENVIRONMENT_DAEMON, 0);
- keyring_init(&g_conf);
FOR_EACH_ARG(args) {
if (CEPH_ARGPARSE_EQ("mkfs", '\0')) {
@@ -83,6 +82,8 @@ int main(int argc, const char **argv)
// -- mkfs --
if (mkfs) {
+ g_conf.daemonize = false;
+ common_init_finish(&g_conf, 0);
if (g_conf.monmap.empty() || !osdmapfn)
usage();
@@ -243,7 +244,6 @@ int main(int argc, const char **argv)
// bind
SimpleMessenger *messenger = new SimpleMessenger();
-
int rank = monmap.get_rank(g_conf.name.get_id());
cout << "starting " << g_conf.name << " rank " << rank
@@ -260,8 +260,7 @@ int main(int argc, const char **argv)
messenger->set_default_send_priority(CEPH_MSG_PRIO_HIGH);
Monitor *mon = new Monitor(g_conf.name.get_id(), &store, messenger, &monmap);
- if (g_conf.daemonize)
- common_init_daemonize(&g_conf);
+ common_init_finish(&g_conf, 0);
messenger->start();
uint64_t supported =
diff --git a/src/common/DoutStreambuf.cc b/src/common/DoutStreambuf.cc
index 7c861737cf3..2c73bcc58d8 100644
--- a/src/common/DoutStreambuf.cc
+++ b/src/common/DoutStreambuf.cc
@@ -222,9 +222,9 @@ DoutStreambuf<charT, traits>::overflow(DoutStreambuf<charT, traits>::int_type c)
}
template <typename charT, typename traits>
-void DoutStreambuf<charT, traits>::handle_stderr_closed()
+void DoutStreambuf<charT, traits>::handle_stderr_shutdown()
{
- // should hold the dout_lock here
+ DoutLocker _dout_locker;
flags &= ~DOUTSB_FLAG_STDERR;
}
@@ -302,7 +302,7 @@ template <typename charT, typename traits>
int DoutStreambuf<charT, traits>::
handle_pid_change(const md_config_t *conf)
{
- // should hold the dout_lock here
+ DoutLocker _dout_locker;
if (!(flags & DOUTSB_FLAG_OFILE))
return 0;
diff --git a/src/common/DoutStreambuf.h b/src/common/DoutStreambuf.h
index 146c482cf5e..4731ae2f605 100644
--- a/src/common/DoutStreambuf.h
+++ b/src/common/DoutStreambuf.h
@@ -54,7 +54,7 @@ public:
// Call when you close stderr. Not strictly necessary, since we would get an
// error the next time we tried to write to stdedrr. But nicer than waiting
// for the error to happen.
- void handle_stderr_closed();
+ void handle_stderr_shutdown();
virtual const char** get_tracked_conf_keys() const;
diff --git a/src/common/ceph_crypto.cc b/src/common/ceph_crypto.cc
index 5ec492ed8ef..940c42f4035 100644
--- a/src/common/ceph_crypto.cc
+++ b/src/common/ceph_crypto.cc
@@ -38,27 +38,15 @@ ceph::crypto::HMACSHA1::~HMACSHA1()
#elif USE_NSS
-static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
-
void ceph::crypto::init() {
- pthread_mutex_lock(&lock);
- if (crypto_init) {
- pthread_mutex_unlock(&lock);
- return;
- }
crypto_init = true;
- pthread_mutex_unlock(&lock);
-
SECStatus s;
s = NSS_NoDB_Init(NULL);
assert(s == SECSuccess);
}
void ceph::crypto::shutdown() {
- pthread_mutex_lock(&lock);
- assert(crypto_init);
crypto_init = false;
- pthread_mutex_unlock(&lock);
SECStatus s;
s = NSS_Shutdown();
assert(s == SECSuccess);
diff --git a/src/common/common_init.cc b/src/common/common_init.cc
index 163a1dcd5c0..debcf93460a 100644
--- a/src/common/common_init.cc
+++ b/src/common/common_init.cc
@@ -115,8 +115,6 @@ md_config_t *common_preinit(const CephInitParameters &iparams,
conf->set_val_or_die("daemonize", "false");
break;
}
-
- ceph::crypto::init();
return conf;
}
@@ -195,29 +193,30 @@ void common_init(std::vector < const char* >& args,
}
}
-// TODO: until this is exposed to libceph/librados somehow, the
-// library users cannot fork and expect to keep using the library
-void common_prefork() {
- // NSS is evil and breaks in forked children; shut it down properly
- // and re-init in both parent and child, after the fork
- ceph::crypto::shutdown();
-}
-
-void common_postfork() {
- ceph::crypto::init();
-}
-
static void pidfile_remove_void(void)
{
pidfile_remove();
}
-// callers that fork must either use common_init_daemonize for that, or
-// call common_prefork/common_postfork around the bit where they fork
-void common_init_daemonize(const md_config_t *conf)
+/* Map stderr to /dev/null. This isn't really re-entrant; we rely on the old unix
+ * behavior that the file descriptor that gets assigned is the lowest
+ * available one.
+ */
+int common_init_shutdown_stderr(const md_config_t *conf)
{
- common_prefork();
+ TEMP_FAILURE_RETRY(close(STDERR_FILENO));
+ if (open("/dev/null", O_RDONLY) < 0) {
+ int err = errno;
+ derr << "common_init_shutdown_stderr: open(/dev/null) failed: error "
+ << err << dendl;
+ return 1;
+ }
+ conf->_doss->handle_stderr_shutdown();
+ return 0;
+}
+static void common_init_daemonize(const md_config_t *conf, int flags)
+{
int num_threads = Thread::get_num_threads();
if (num_threads > 1) {
derr << "common_init_daemonize: BUG: there are " << num_threads - 1
@@ -225,7 +224,7 @@ void common_init_daemonize(const md_config_t *conf)
exit(1);
}
- int ret = daemon(1, 0);
+ int ret = daemon(1, 1);
if (ret) {
ret = errno;
derr << "common_init_daemonize: BUG: daemon error: "
@@ -246,11 +245,52 @@ void common_init_daemonize(const md_config_t *conf)
<< "to run at exit." << dendl;
}
- // move these things into observers.
+ /* This is the old trick where we make file descriptors 0, 1, and possibly 2
+ * point to /dev/null.
+ *
+ * We have to do this because otherwise some arbitrary call to open() later
+ * in the program might get back one of these file descriptors. It's hard to
+ * guarantee that nobody ever writes to stdout, even though they're not
+ * supposed to.
+ */
+ TEMP_FAILURE_RETRY(close(STDIN_FILENO));
+ if (open("/dev/null", O_RDONLY) < 0) {
+ int err = errno;
+ derr << "common_init_daemonize: open(/dev/null) failed: error "
+ << err << dendl;
+ exit(1);
+ }
+ TEMP_FAILURE_RETRY(close(STDOUT_FILENO));
+ if (open("/dev/null", O_RDONLY) < 0) {
+ int err = errno;
+ derr << "common_init_daemonize: open(/dev/null) failed: error "
+ << err << dendl;
+ exit(1);
+ }
+ if (!(flags & CINIT_FLAG_NO_DEFAULT_CONFIG_FILE)) {
+ ret = common_init_shutdown_stderr(conf);
+ if (ret) {
+ derr << "common_init_daemonize: common_init_shutdown_stderr failed with "
+ << "error code " << ret << dendl;
+ exit(1);
+ }
+ }
pidfile_write(&g_conf);
- dout_handle_daemonize(&g_conf);
-
+ ret = conf->_doss->handle_pid_change(&g_conf);
+ if (ret) {
+ derr << "common_init_daemonize: _doss->handle_pid_change failed with "
+ << "error code " << ret << dendl;
+ exit(1);
+ }
dout(1) << "finished common_init_daemonize" << dendl;
+}
- common_postfork();
+void common_init_finish(const md_config_t *conf, int flags)
+{
+ if ((g_code_env == CODE_ENVIRONMENT_DAEMON) && (g_conf.daemonize)) {
+ common_init_daemonize(conf, flags);
+ }
+ ceph::crypto::init();
+ keyring_init(&g_conf);
}
+
diff --git a/src/common/common_init.h b/src/common/common_init.h
index 411f333b9d8..d16233057ae 100644
--- a/src/common/common_init.h
+++ b/src/common/common_init.h
@@ -17,6 +17,9 @@ enum common_init_flags_t {
// By default, don't read a configuration file
CINIT_FLAG_NO_DEFAULT_CONFIG_FILE = 0x2,
+
+ // Don't close stderr
+ CINIT_FLAG_NO_CLOSE_STDERR = 0x4,
};
int keyring_init(md_config_t *conf);
@@ -26,8 +29,7 @@ void complain_about_parse_errors(std::deque<std::string> *parse_errors);
void common_init(std::vector < const char* >& args,
uint32_t module_type, code_environment_t code_env, int flags);
void output_ceph_version();
-void common_prefork();
-void common_postfork();
-void common_init_daemonize(const md_config_t *conf);
+int common_init_shutdown_stderr(const md_config_t *conf);
+void common_init_finish(const md_config_t *conf, int flags);
#endif
diff --git a/src/common/debug.cc b/src/common/debug.cc
index 8a01e200ba4..b66c80fc9fa 100644
--- a/src/common/debug.cc
+++ b/src/common/debug.cc
@@ -17,14 +17,6 @@ DoutStreambuf <char> *_doss = g_conf._doss;
*/
pthread_mutex_t _dout_lock = PTHREAD_MUTEX_INITIALIZER;
-int dout_handle_daemonize(md_config_t *conf)
-{
- DoutLocker _dout_locker;
-
- conf->_doss->handle_stderr_closed();
- return conf->_doss->handle_pid_change(&g_conf);
-}
-
void output_ceph_version()
{
char buf[1024];
diff --git a/src/common/debug.h b/src/common/debug.h
index e596cd152f6..255f63cc62d 100644
--- a/src/common/debug.h
+++ b/src/common/debug.h
@@ -30,8 +30,6 @@ extern DoutStreambuf <char, std::basic_string<char>::traits_type> *_doss;
class md_config_t;
extern pthread_mutex_t _dout_lock;
-extern int dout_handle_daemonize(md_config_t *conf);
-
extern void dout_emergency(const char * const str);
extern void dout_emergency(const std::string &str);
diff --git a/src/cosd.cc b/src/cosd.cc
index 4cea4ea0cc9..8a6da9ad730 100644
--- a/src/cosd.cc
+++ b/src/cosd.cc
@@ -83,10 +83,9 @@ int main(int argc, const char **argv)
}
}
- if (!mkfs)
- keyring_init(&g_conf);
-
if (dump_pg_log) {
+ g_conf.daemonize = false;
+ common_init_finish(&g_conf, 0);
bufferlist bl;
int r = bl.read_file(dump_pg_log);
if (r >= 0) {
@@ -123,13 +122,13 @@ int main(int argc, const char **argv)
usage();
}
- // get monmap
- RotatingKeyRing rkeys(CEPH_ENTITY_TYPE_OSD, &g_keyring);
- MonClient mc(&rkeys);
- if (mc.build_initial_monmap() < 0)
- return -1;
-
if (mkfs) {
+ g_conf.daemonize = false;
+ common_init_finish(&g_conf, 0);
+ RotatingKeyRing rkeys(CEPH_ENTITY_TYPE_OSD, &g_keyring);
+ MonClient mc(&rkeys);
+ if (mc.build_initial_monmap() < 0)
+ return -1;
if (mc.get_monmap_privately() < 0)
return -1;
@@ -145,6 +144,8 @@ int main(int argc, const char **argv)
*_dout << " for osd" << whoami << " fsid " << mc.monmap.fsid << dendl;
}
if (mkkey) {
+ g_conf.daemonize = false;
+ common_init_finish(&g_conf, 0);
EntityName ename(g_conf.name);
EntityAuth eauth;
eauth.key.create(CEPH_CRYPTO_AES);
@@ -161,6 +162,8 @@ int main(int argc, const char **argv)
if (mkfs || mkkey)
exit(0);
if (mkjournal) {
+ g_conf.daemonize = false;
+ common_init_finish(&g_conf, 0);
int err = OSD::mkjournal(g_conf.osd_data, g_conf.osd_journal);
if (err < 0) {
derr << TEXT_RED << " ** ERROR: error creating fresh journal " << g_conf.osd_journal
@@ -173,6 +176,8 @@ int main(int argc, const char **argv)
exit(0);
}
if (flushjournal) {
+ g_conf.daemonize = false;
+ common_init_finish(&g_conf, 0);
int err = OSD::flushjournal(g_conf.osd_data, g_conf.osd_journal);
if (err < 0) {
derr << TEXT_RED << " ** ERROR: error flushing journal " << g_conf.osd_journal
@@ -270,11 +275,16 @@ int main(int argc, const char **argv)
cluster_messenger->set_policy(entity_name_t::TYPE_CLIENT,
SimpleMessenger::Policy::stateless_server(0, 0));
-
+ // Set up crypto, daemonize, etc.
+ // Leave stderr open in case we need to report errors.
+ common_init_finish(&g_conf, CINIT_FLAG_NO_CLOSE_STDERR);
+ RotatingKeyRing rkeys(CEPH_ENTITY_TYPE_OSD, &g_keyring);
+ MonClient mc(&rkeys);
+ if (mc.build_initial_monmap() < 0)
+ return -1;
OSD *osd = new OSD(whoami, cluster_messenger, client_messenger, messenger_hb, &mc,
g_conf.osd_data, g_conf.osd_journal);
-
int err = osd->pre_init();
if (err < 0) {
derr << TEXT_RED << " ** ERROR: initializing osd failed: " << cpp_strerror(-err)
@@ -282,8 +292,9 @@ int main(int argc, const char **argv)
return 1;
}
- if (g_conf.daemonize)
- common_init_daemonize(&g_conf);
+ // Now close the standard file descriptors
+ common_init_shutdown_stderr(&g_conf);
+
client_messenger->start();
messenger_hb->start();
cluster_messenger->start();
diff --git a/src/csyn.cc b/src/csyn.cc
index da9c90a66fa..782c0a79b73 100644
--- a/src/csyn.cc
+++ b/src/csyn.cc
@@ -47,7 +47,7 @@ int main(int argc, const char **argv, char *envp[])
argv_to_vec(argc, argv, args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- keyring_init(&g_conf);
+ common_init_finish(&g_conf, 0);
parse_syn_options(args); // for SyntheticClient
diff --git a/src/dumpjournal.cc b/src/dumpjournal.cc
index 0f6f7924f4d..6496a3da30d 100644
--- a/src/dumpjournal.cc
+++ b/src/dumpjournal.cc
@@ -82,6 +82,7 @@ int main(int argc, const char **argv, const char *envp[])
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
+ common_init_finish(&g_conf, 0);
vec_to_argv(args, argc, argv);
diff --git a/src/dupstore.cc b/src/dupstore.cc
index e29482866fd..654e3bbb382 100644
--- a/src/dupstore.cc
+++ b/src/dupstore.cc
@@ -88,6 +88,7 @@ int main(int argc, const char **argv)
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
+ common_init_finish(&g_conf, 0);
// args
if (args.size() != 4)
diff --git a/src/librados-config.cc b/src/librados-config.cc
index cc07d7d738c..8b9aa7615ff 100644
--- a/src/librados-config.cc
+++ b/src/librados-config.cc
@@ -58,6 +58,7 @@ int main(int argc, const char **argv)
}
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
+ common_init_finish(&g_conf, 0);
FOR_EACH_ARG(args) {
usage_exit();
diff --git a/src/monmaptool.cc b/src/monmaptool.cc
index fac8b3aca6e..00854e38afa 100644
--- a/src/monmaptool.cc
+++ b/src/monmaptool.cc
@@ -51,6 +51,7 @@ int main(int argc, const char **argv)
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY,
CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
+ common_init_finish(&g_conf, 0);
FOR_EACH_ARG(args) {
if (CEPH_ARGPARSE_EQ("print", '\0')) {
CEPH_ARGPARSE_SET_ARG_VAL(&print, OPT_BOOL);
diff --git a/src/osdmaptool.cc b/src/osdmaptool.cc
index 62a8d5acdc6..a494453e29a 100644
--- a/src/osdmaptool.cc
+++ b/src/osdmaptool.cc
@@ -51,6 +51,7 @@ int main(int argc, const char **argv)
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY,
CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
+ common_init_finish(&g_conf, 0);
const char *me = argv[0];
diff --git a/src/rados.cc b/src/rados.cc
index b3faef0629b..a9591a3160f 100644
--- a/src/rados.cc
+++ b/src/rados.cc
@@ -659,7 +659,7 @@ int main(int argc, const char **argv)
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- keyring_init(&g_conf);
+ common_init_finish(&g_conf, 0);
std::map < std::string, std::string > opts;
std::vector<const char*>::iterator i;
diff --git a/src/rbd.cc b/src/rbd.cc
index a5ab28255b7..855dd023c76 100644
--- a/src/rbd.cc
+++ b/src/rbd.cc
@@ -825,7 +825,7 @@ int main(int argc, const char **argv)
int opt_cmd = OPT_NO_CMD;
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- keyring_init(&g_conf);
+ common_init_finish(&g_conf, 0);
const char *poolname = NULL;
uint64_t size = 0;
diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc
index c25dea2fec0..1944c2f83af 100644
--- a/src/rgw/rgw_admin.cc
+++ b/src/rgw/rgw_admin.cc
@@ -176,7 +176,7 @@ int main(int argc, char **argv)
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- keyring_init(&g_conf);
+ common_init_finish(&g_conf, 0);
const char *user_id = 0;
const char *access_key = 0;
diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc
index 932960a329a..e3948e58dde 100644
--- a/src/rgw/rgw_main.cc
+++ b/src/rgw/rgw_main.cc
@@ -75,6 +75,7 @@ int main(int argc, const char **argv)
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
+ common_init_finish(&g_conf, 0);
if (!RGWAccess::init_storage_provider("rados", &g_conf)) {
derr << "Couldn't init storage provider (RADOS)" << dendl;
@@ -83,7 +84,6 @@ int main(int argc, const char **argv)
sighandler_usr1 = signal(SIGUSR1, godown_handler);
sighandler_alrm = signal(SIGALRM, godown_alarm);
- common_postfork();
while (FCGX_Accept(&fcgx.in, &fcgx.out, &fcgx.err, &fcgx.envp) >= 0)
{
diff --git a/src/streamtest.cc b/src/streamtest.cc
index 3ffe1da4e2b..08c8ab957ae 100644
--- a/src/streamtest.cc
+++ b/src/streamtest.cc
@@ -97,7 +97,7 @@ int main(int argc, const char **argv)
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- keyring_init(&g_conf);
+ common_init_finish(&g_conf, 0);
// args
if (args.size() < 3) return -1;
diff --git a/src/test/TestDoutStreambuf.cc b/src/test/TestDoutStreambuf.cc
index 8eda5ba3860..01a8a6f18b8 100644
--- a/src/test/TestDoutStreambuf.cc
+++ b/src/test/TestDoutStreambuf.cc
@@ -38,6 +38,7 @@ int main(int argc, const char **argv)
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
+ common_init_finish(&g_conf, 0);
DoutStreambuf<char> *dos = new DoutStreambuf<char>();
diff --git a/src/test/TestSignalHandlers.cc b/src/test/TestSignalHandlers.cc
index 71bc8bee4ab..c117b00a570 100644
--- a/src/test/TestSignalHandlers.cc
+++ b/src/test/TestSignalHandlers.cc
@@ -95,6 +95,7 @@ int main(int argc, const char **argv)
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
+ common_init_finish(&g_conf, 0);
DEFINE_CONF_VARS(usage);
FOR_EACH_ARG(args) {
diff --git a/src/test/TestTimers.cc b/src/test/TestTimers.cc
index f3c9d78a786..63006ff3f3c 100644
--- a/src/test/TestTimers.cc
+++ b/src/test/TestTimers.cc
@@ -256,6 +256,7 @@ int main(int argc, const char **argv)
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
+ common_init_finish(&g_conf, 0);
int ret;
Mutex safe_timer_lock("safe_timer_lock");
diff --git a/src/test/test_mutate.cc b/src/test/test_mutate.cc
index 4581ddfd568..aeec5416c86 100644
--- a/src/test/test_mutate.cc
+++ b/src/test/test_mutate.cc
@@ -44,7 +44,7 @@ int main(int argc, const char **argv)
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- keyring_init(&g_conf);
+ common_init_finish(&g_conf, 0);
string val;
string oid("test_object");
diff --git a/src/test_trans.cc b/src/test_trans.cc
index 7a31e73d81f..205d2d424be 100644
--- a/src/test_trans.cc
+++ b/src/test_trans.cc
@@ -36,6 +36,7 @@ int main(int argc, const char **argv)
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
+ common_init_finish(&g_conf, 0);
// args
if (args.size() < 2) return -1;
diff --git a/src/testmsgr.cc b/src/testmsgr.cc
index 18a50ffe75c..5e722a5b492 100644
--- a/src/testmsgr.cc
+++ b/src/testmsgr.cc
@@ -71,6 +71,7 @@ int main(int argc, const char **argv, const char *envp[]) {
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
+ common_init_finish(&g_conf, 0);
vec_to_argv(args, argc, argv);
diff --git a/src/tools/ceph.cc b/src/tools/ceph.cc
index de4fddcf9a2..ed1758a10a9 100644
--- a/src/tools/ceph.cc
+++ b/src/tools/ceph.cc
@@ -116,7 +116,7 @@ int main(int argc, const char **argv)
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- keyring_init(&g_conf);
+ common_init_finish(&g_conf, 0);
vec_to_argv(args, argc, argv);
diff --git a/src/tools/gceph.cc b/src/tools/gceph.cc
index 63d8d3f31ae..5cc249cb703 100644
--- a/src/tools/gceph.cc
+++ b/src/tools/gceph.cc
@@ -76,7 +76,7 @@ int main(int argc, const char **argv)
env_to_vec(args);
common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
- keyring_init(&g_conf);
+ common_init_finish(&g_conf, 0);
vec_to_argv(args, argc, argv);