]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async: do not make Stack a fork watcher
authorSage Weil <sage@redhat.com>
Wed, 28 Feb 2018 15:51:30 +0000 (09:51 -0600)
committerSage Weil <sage@redhat.com>
Sun, 4 Mar 2018 21:31:54 +0000 (15:31 -0600)
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 <sage@redhat.com>
src/msg/async/Stack.cc
src/msg/async/Stack.h

index 86005434b87f3d12caf04a7a53de4ec8a7e0bbec..9eeb9bd91071cc4c65677d41dd31b652f34eca8f 100644 (file)
@@ -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()
index 8606620ae5032feee39334e474b24ce777658d80..c175f812977c003f3f56566d357d0d745b666071 100644 (file)
@@ -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<void ()> &&) = 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() { };
 };