]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/Pipe: inject delay in stop_and_wait 2825/head
authorSage Weil <sage@redhat.com>
Fri, 31 Oct 2014 23:25:09 +0000 (16:25 -0700)
committerSage Weil <sage@redhat.com>
Thu, 13 Nov 2014 17:14:40 +0000 (09:14 -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>
src/msg/simple/Pipe.cc

index 4acabae1e7c64a4e002d35108818ddb6bccb93c8..32c144fb79bcefe54f5af60c142c47cf26fb3b4c 100644 (file)
@@ -1446,6 +1446,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