]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
neorados: Avoid double cleanup in watch/notify
authorAdam C. Emerson <aemerson@redhat.com>
Wed, 26 Nov 2025 05:59:13 +0000 (00:59 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Thu, 14 May 2026 23:17:47 +0000 (19:17 -0400)
An error coming in after `maybe_cleanup()` is called could trigger it
again. Add a flag to prevent that.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
(cherry picked from commit d4ee87e985a6f2234050fd85d31564b7776bf1e6)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/neorados/RADOS.cc

index 8716ca10747a2b9f73de9004b776c6a23ffebd18..b09a3f430cb6201e823a36bb89136c8f1746a6cc 100644 (file)
@@ -1692,6 +1692,7 @@ struct NotifyHandler : std::enable_shared_from_this<NotifyHandler> {
   bool finished = false;
   bs::error_code res;
   bufferlist rbl;
+  bool cleaned = false;
 
   NotifyHandler(asio::io_context& ioc,
                Objecter* objecter,
@@ -1726,9 +1727,13 @@ struct NotifyHandler : std::enable_shared_from_this<NotifyHandler> {
 
   // Should be called from strand.
   void maybe_cleanup(bs::error_code ec) {
+    if (cleaned) {
+      return;
+    }
     if (!res && ec)
       res = ec;
     if ((acked && finished) || res) {
+      cleaned = true;
       objecter->linger_cancel(op.get());
       ceph_assert(c);
       bc::flat_map<std::pair<uint64_t, uint64_t>, buffer::list> reply_map;