]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/Timer: recheck stopping before sleep if we dropped the lock
authorSage Weil <sage@redhat.com>
Fri, 24 Oct 2014 16:20:41 +0000 (09:20 -0700)
committerSage Weil <sage@redhat.com>
Fri, 24 Oct 2014 16:20:41 +0000 (09:20 -0700)
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 <sage@redhat.com>
src/common/Timer.cc

index 6282eacec13d6930d0cdc152fc2ecd35559de48b..e398841c5baa7968534f35d92ed02cd9987ef027 100644 (file)
@@ -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);