]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
neorados: Notifier holds intrusive_ptr<LingerOp>
authorCasey Bodley <cbodley@redhat.com>
Thu, 11 Dec 2025 19:16:20 +0000 (14:16 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Thu, 14 May 2026 23:17:47 +0000 (19:17 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 9456aa73689924a0ad85005e824444b48d3c7d99)
Fixes: https://tracker.ceph.com/issues/76434
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/neorados/RADOS.cc

index 2a4b0ac49b103a48350d8c7eb02c7ac2b2c8bef5..bd5f97ae79e417de4a1fd2969d573b8cff49a964 100644 (file)
@@ -1396,7 +1396,7 @@ class Notifier : public async::service_list_base_hook {
   };
 
   asio::io_context::executor_type ex;
-  Objecter::LingerOp* linger_op;
+  boost::intrusive_ptr<Objecter::LingerOp> linger_op;
   // Zero for unbounded. I would not recommend this.
   const uint32_t capacity;
 
@@ -1411,18 +1411,17 @@ class Notifier : public async::service_list_base_hook {
     if (neoref) {
       neoref = nullptr;
     }
-    if (linger_op) {
-      linger_op->put();
-    }
+    linger_op.reset();
     std::unique_lock l(m);
     handlers.clear();
   }
 
 public:
 
-  Notifier(asio::io_context::executor_type ex, Objecter::LingerOp* linger_op,
+  Notifier(asio::io_context::executor_type ex,
+          boost::intrusive_ptr<Objecter::LingerOp> linger_op,
           uint32_t capacity, std::shared_ptr<detail::Client> neoref)
-    : ex(ex), linger_op(linger_op), capacity(capacity),
+    : ex(ex), linger_op(std::move(linger_op)), capacity(capacity),
       svc(asio::use_service<async::service<Notifier>>(
            asio::query(ex, boost::asio::execution::context))),
       neoref(std::move(neoref)) {
@@ -1537,12 +1536,12 @@ void RADOS::watch_(Object o, IOContext _ioc,
   auto e = asio::prefer(get_executor(),
                        asio::execution::outstanding_work.tracked);
   impl->objecter->linger_watch(
-    linger_op, op, ioc->snapc, ceph::real_clock::now(), bl,
+    linger_op.get(), op, ioc->snapc, ceph::real_clock::now(), bl,
     asio::bind_executor(
       std::move(e),
       [c = std::move(c), cookie, linger_op](bs::error_code e, cb::list) mutable {
        if (e) {
-         linger_op->objecter->linger_cancel(linger_op);
+         linger_op->objecter->linger_cancel(linger_op.get());
          cookie = 0;
        }
        asio::dispatch(asio::append(std::move(c), e, cookie));
@@ -1571,13 +1570,13 @@ void RADOS::watch_(Object o, IOContext _ioc, WatchComp c,
   auto e = asio::prefer(get_executor(),
                        asio::execution::outstanding_work.tracked);
   impl->objecter->linger_watch(
-    linger_op, op, ioc->snapc, ceph::real_clock::now(), bl,
+    linger_op.get(), op, ioc->snapc, ceph::real_clock::now(), bl,
     asio::bind_executor(
       std::move(e),
       [c = std::move(c), cookie, linger_op](bs::error_code e, cb::list) mutable {
        if (e) {
          linger_op->user_data.reset();
-         linger_op->objecter->linger_cancel(linger_op);
+         linger_op->objecter->linger_cancel(linger_op.get());
          cookie = 0;
        }
        asio::dispatch(asio::append(std::move(c), e, cookie));