From: Sage Weil Date: Fri, 24 Oct 2014 16:20:41 +0000 (-0700) Subject: common/Timer: recheck stopping before sleep if we dropped the lock X-Git-Tag: v0.87~8^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=48484356bbeae5d4da29861712a48155a1782b15;p=ceph.git common/Timer: recheck stopping before sleep if we dropped the lock If we have safe_callbacks==false, the stopping flag may have changed while we were doing our callback. Recheck it and exit to avoid a deadlock on shutdown. Signed-off-by: Sage Weil --- diff --git a/src/common/Timer.cc b/src/common/Timer.cc index 6282eacec13d..e398841c5baa 100644 --- a/src/common/Timer.cc +++ b/src/common/Timer.cc @@ -107,6 +107,10 @@ void SafeTimer::timer_thread() lock.Lock(); } + // recheck stopping if we dropped the lock + if (!safe_callbacks && stopping) + break; + ldout(cct,20) << "timer_thread going to sleep" << dendl; if (schedule.empty()) cond.Wait(lock);