]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "msg/async: Postpone bind if network stack is not ready"
authorAmir Vadai <amir@vadai.me>
Tue, 23 May 2017 07:33:30 +0000 (10:33 +0300)
committerAmir Vadai <amir@vadai.me>
Tue, 23 May 2017 14:03:56 +0000 (17:03 +0300)
This reverts commit a5b87e2fb83adec2b0fe060d3b22acfb1b9db1ed.

Change-Id: Ia1bc0535636de27d599cfb2dc7be2a555e0a2cd7
Issue: 995322
Signed-off-by: Amir Vadai <amir@vadai.me>
src/msg/async/AsyncMessenger.cc
src/msg/async/AsyncMessenger.h
src/msg/async/Stack.h
src/msg/async/rdma/RDMAStack.h

index 122473179c3c39af384fc5fbf25fad52f1f55bfa..814d058c8f73150378f4ad8c03f232138c035e94 100644 (file)
@@ -291,15 +291,6 @@ void AsyncMessenger::ready()
 {
   ldout(cct,10) << __func__ << " " << get_myaddr() << dendl;
 
-  stack->ready();
-  if (pending_bind) {
-    int err = bind(pending_bind_addr);
-    if (err) {
-      lderr(cct) << __func__ << " postponed bind failed" << dendl;
-      ceph_abort();
-    }
-  }
-
   Mutex::Locker l(lock);
   for (auto &&p : processors)
     p->start();
@@ -329,23 +320,12 @@ int AsyncMessenger::shutdown()
 int AsyncMessenger::bind(const entity_addr_t &bind_addr)
 {
   lock.Lock();
-
-  if (!pending_bind && started) {
+  if (started) {
     ldout(cct,10) << __func__ << " already started" << dendl;
     lock.Unlock();
     return -1;
   }
-
   ldout(cct,10) << __func__ << " bind " << bind_addr << dendl;
-
-  if (!stack->is_ready()) {
-    ldout(cct, 10) << __func__ << " Network Stack is not ready for bind yet - postponed" << dendl;
-    pending_bind_addr = bind_addr;
-    pending_bind = true;
-    lock.Unlock();
-    return 0;
-  }
-
   lock.Unlock();
 
   // bind to a socket
index 01af51104959c53404a8416c7f982781bda1c81e..c234a70a442a5668281a0881b742a94079a02c76 100644 (file)
@@ -236,17 +236,6 @@ private:
   // maybe this should be protected by the lock?
   bool need_addr;
 
-  /**
-   * set to bind address if bind was called before NetworkStack was ready to
-   * bind
-   */
-  entity_addr_t pending_bind_addr;
-
-  /**
-   * false; set to true if a pending bind exists
-   */
-  bool pending_bind = false;
-
   /**
    *  The following aren't lock-protected since you shouldn't be able to race
    *  the only writers.
index 3b7adca35da201cb59b725213d72b244f56e2ea2..2ddfa8c6754fdb1c2d0a03725686a6ca64e31009 100644 (file)
@@ -287,6 +287,7 @@ class NetworkStack : public CephContext::ForkWatcher {
  protected:
   CephContext *cct;
   vector<Worker*> workers;
+  // Used to indicate whether thread started
 
   explicit NetworkStack(CephContext *c, const string &t);
  public:
@@ -336,8 +337,6 @@ class NetworkStack : public CephContext::ForkWatcher {
     start();
   }
 
-  virtual bool is_ready() { return true; };
-  virtual void ready() { };
 };
 
 #endif //CEPH_MSG_ASYNC_STACK_H
index 9043ed1db7b7b2420efdba826f61e1be48971f6b..1585d65b26ab0b680d86655ced2f91d77a456a4d 100644 (file)
@@ -198,8 +198,6 @@ class RDMAStack : public NetworkStack {
   RDMADispatcher *dispatcher;
   PerfCounters *perf_counter;
 
-  std::atomic<bool> fork_finished = {false};
-
  public:
   explicit RDMAStack(CephContext *cct, const string &t);
   virtual ~RDMAStack();
@@ -209,8 +207,5 @@ class RDMAStack : public NetworkStack {
   virtual void spawn_worker(unsigned i, std::function<void ()> &&func) override;
   virtual void join_worker(unsigned i) override;
   RDMADispatcher *get_dispatcher() { return dispatcher; }
-
-  virtual bool is_ready() override { return fork_finished.load(); };
-  virtual void ready() override { fork_finished = true; };
 };
 #endif