From 48484356bbeae5d4da29861712a48155a1782b15 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 24 Oct 2014 09:20:41 -0700 Subject: [PATCH] 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 --- src/common/Timer.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/Timer.cc b/src/common/Timer.cc index 6282eacec13d6..e398841c5baa7 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); -- 2.39.5