]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/Pipe: inject delay in stop_and_wait
authorSage Weil <sage@redhat.com>
Fri, 31 Oct 2014 23:25:09 +0000 (16:25 -0700)
committerSage Weil <sage@redhat.com>
Mon, 12 Jan 2015 19:17:15 +0000 (11:17 -0800)
Inject a delay in stop_and_wait.  This will mostly affect the connection
race Pipe takeover code which currently calls stop_and_wait while holding
the msgr->lock.  This should make it easier for a racing fast_dispatch
method to get stuck on a call that (indirectly) needs the msgr lock.
See #9921.

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 2fe5c4c305218fdb1771857e4e0ef7c98a8d0fb6)

src/msg/Pipe.cc

index e73e2b1c8326f9094bc279c938e8422c5e1f5130..32e20db3f156b34a76563cd1f4189e5dd65fd1d1 100644 (file)
@@ -1437,6 +1437,15 @@ void Pipe::stop_and_wait()
 {
   if (state != STATE_CLOSED)
     stop();
+
+  if (msgr->cct->_conf->ms_inject_internal_delays) {
+    ldout(msgr->cct, 10) << __func__ << " sleep for "
+                        << msgr->cct->_conf->ms_inject_internal_delays
+                        << dendl;
+    utime_t t;
+    t.set_from_double(msgr->cct->_conf->ms_inject_internal_delays);
+    t.sleep();
+  }
   
   // HACK: we work around an annoying deadlock here.  If the fast
   // dispatch method calls mark_down() on itself, it can block here