From: Sage Weil Date: Fri, 31 Oct 2014 23:25:09 +0000 (-0700) Subject: msg/Pipe: inject delay in stop_and_wait X-Git-Tag: v0.90~23^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2fe5c4c305218fdb1771857e4e0ef7c98a8d0fb6;p=ceph.git msg/Pipe: inject delay in stop_and_wait 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 --- diff --git a/src/msg/simple/Pipe.cc b/src/msg/simple/Pipe.cc index 4acabae1e7c6..32c144fb79bc 100644 --- a/src/msg/simple/Pipe.cc +++ b/src/msg/simple/Pipe.cc @@ -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