From: Kefu Chai Date: Sun, 7 Mar 2021 02:55:35 +0000 (+0800) Subject: crimson/osd: no need to clear watchers beforehand X-Git-Tag: v17.1.0~2713^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b2b6c3537dae39b735a62f8790faab8a5ecaeb1c;p=ceph.git crimson/osd: no need to clear watchers beforehand as long as we don't yield, we can assume the atomicity. Signed-off-by: Kefu Chai --- diff --git a/src/crimson/osd/watch.cc b/src/crimson/osd/watch.cc index 789d0fd346b..bcf535ab1c6 100644 --- a/src/crimson/osd/watch.cc +++ b/src/crimson/osd/watch.cc @@ -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