]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: no need to clear watchers beforehand 39895/head
authorKefu Chai <kchai@redhat.com>
Sun, 7 Mar 2021 02:55:35 +0000 (10:55 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 7 Mar 2021 02:55:37 +0000 (10:55 +0800)
as long as we don't yield, we can assume the atomicity.

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

index 789d0fd346b954fad50dabff7b8fe70f4f1b5bcb..bcf535ab1c630adb292fa94a1e0449856c15feab 100644 (file)
@@ -198,12 +198,11 @@ void Notify::do_timeout()
   if (complete) {
     return;
   }
-  decltype(watchers) timedout_watchers;
-  std::swap(watchers, timedout_watchers);
-  for (auto& watcher : timedout_watchers) {
+  for (auto& watcher : watchers) {
     watcher->cancel_notify(ninfo.notify_id);
   }
-  std::ignore = maybe_send_completion(std::move(timedout_watchers));
+  std::ignore = maybe_send_completion(std::move(watchers));
+  watchers.clear();
 }
 
 } // namespace crimson::osd