From: Sage Weil Date: Wed, 28 Feb 2018 15:51:30 +0000 (-0600) Subject: msg/async: do not make Stack a fork watcher X-Git-Tag: v13.0.2~79^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=85f6873e0420405ce1682abfc2c2884fa102a239;p=ceph.git msg/async: do not make Stack a fork watcher Instead of doing a stop/start on fork, shut down entirely pre-fork. This is a cleaner solution for the cases where e.g. the parent does not need to restart the msgr at all (this is usually the case!) but does need to call psotfork_start in order to restart log thread (which is assumed to be running when the parent's cct is destroyed). Signed-off-by: Sage Weil --- diff --git a/src/msg/async/Stack.cc b/src/msg/async/Stack.cc index 86005434b87f..9eeb9bd91071 100644 --- a/src/msg/async/Stack.cc +++ b/src/msg/async/Stack.cc @@ -120,7 +120,6 @@ NetworkStack::NetworkStack(CephContext *c, const string &t): type(t), started(fa w->center.init(InitEventNumber, i, type); workers.push_back(w); } - cct->register_fork_watcher(this); } void NetworkStack::start() diff --git a/src/msg/async/Stack.h b/src/msg/async/Stack.h index 8606620ae503..c175f812977c 100644 --- a/src/msg/async/Stack.h +++ b/src/msg/async/Stack.h @@ -284,7 +284,7 @@ class Worker { } }; -class NetworkStack : public CephContext::ForkWatcher { +class NetworkStack { std::string type; unsigned num_workers = 0; ceph::spinlock pool_spin; @@ -300,7 +300,7 @@ class NetworkStack : public CephContext::ForkWatcher { public: NetworkStack(const NetworkStack &) = delete; NetworkStack& operator=(const NetworkStack &) = delete; - ~NetworkStack() override { + virtual ~NetworkStack() { for (auto &&w : workers) delete w; } @@ -336,14 +336,6 @@ class NetworkStack : public CephContext::ForkWatcher { virtual void spawn_worker(unsigned i, std::function &&) = 0; virtual void join_worker(unsigned i) = 0; - void handle_pre_fork() override { - stop(); - } - - void handle_post_fork() override { - start(); - } - virtual bool is_ready() { return true; }; virtual void ready() { }; };