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.87.1~31^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c3335c7aa6c1e6c3f1879c0cd3cd2f13091221be;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 (cherry picked from commit 2fe5c4c305218fdb1771857e4e0ef7c98a8d0fb6) --- diff --git a/src/msg/Pipe.cc b/src/msg/Pipe.cc index e73e2b1c8326..32e20db3f156 100644 --- a/src/msg/Pipe.cc +++ b/src/msg/Pipe.cc @@ -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