]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: cleanup Notify::send_completion()
authorKefu Chai <kchai@redhat.com>
Sun, 7 Mar 2021 13:32:28 +0000 (21:32 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 7 Mar 2021 13:51:58 +0000 (21:51 +0800)
Notify::send_completion() should just send the completion message. so,
move irrelevant code out of Notify::send_completion().

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/watch.cc

index 261bd18040cb8ad7173c7461314e28d6c9b9b158..8898be8bdf3abe8028de7740d303280a0dbc59d2 100644 (file)
@@ -146,6 +146,9 @@ seastar::future<> Notify::remove_watcher(WatchRef watch)
   [[maybe_unused]] const auto num_removed = watchers.erase(watch);
   assert(num_removed > 0);
   if (watchers.empty()) {
+    complete = true;
+    [[maybe_unused]] bool was_armed = timeout_timer.cancel();
+    assert(was_armed);
     return send_completion();
   } else {
     return seastar::now();
@@ -173,8 +176,6 @@ seastar::future<> Notify::send_completion(
   logger().info("{} -- {} in progress watchers, {} timedout watchers {}",
                 __func__, watchers.size(), timedout_watchers.size());
   logger().debug("{} sending notify replies: {}", __func__, notify_replies);
-  complete = true;
-  timeout_timer.cancel();
 
   ceph::bufferlist empty;
   auto reply = make_message<MWatchNotify>(