]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/Timer: do not add event if already shutdown 16201/head
authorKefu Chai <kchai@redhat.com>
Fri, 7 Jul 2017 05:44:03 +0000 (13:44 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 7 Jul 2017 07:08:19 +0000 (15:08 +0800)
otherwise the callback is leaked.

Fixes: http://tracker.ceph.com/issues/20432
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/common/Timer.cc

index ef76a9e41b7dd2450d08154efa61b557165c831b..82e090148f3bc8bc8c0b0da3b5900688501ae4a5 100644 (file)
@@ -126,8 +126,11 @@ void SafeTimer::add_event_after(double seconds, Context *callback)
 void SafeTimer::add_event_at(utime_t when, Context *callback)
 {
   assert(lock.is_locked());
-  ldout(cct,10) << "add_event_at " << when << " -> " << callback << dendl;
-
+  ldout(cct,10) << __func__ << " " << when << " -> " << callback << dendl;
+  if (stopping) {
+    ldout(cct,5) << __func__ << " already shutdown, event not added" << dendl;
+    delete callback;
+  }
   scheduled_map_t::value_type s_val(when, callback);
   scheduled_map_t::iterator i = schedule.insert(s_val);