]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc: linger_register() returns intrusive_ptr<LingerOp>
authorCasey Bodley <cbodley@redhat.com>
Thu, 11 Dec 2025 19:17:53 +0000 (14:17 -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 4064da7ce716b42ce4924787024fd7ce01182762)
Fixes: https://tracker.ceph.com/issues/76434
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/librados/IoCtxImpl.cc
src/neorados/RADOS.cc
src/osdc/Objecter.cc
src/osdc/Objecter.h

index 81e056d6e60f2318df41e590410c8b2d2ef7aee5..139a56f417885c6b87a4563186cab9217c4dcccc 100644 (file)
@@ -1661,8 +1661,8 @@ int librados::IoCtxImpl::watch(const object_t& oid, uint64_t *handle,
   version_t objver;
   C_SaferCond onfinish;
 
-  Objecter::LingerOp *linger_op = objecter->linger_register(oid, oloc,
-                                                            extra_op_flags);
+  boost::intrusive_ptr linger_op = objecter->linger_register(oid, oloc,
+                                                             extra_op_flags);
   *handle = linger_op->get_cookie();
   if (internal) {
     linger_op->handle = InternalWatchInfo(this, oid, ctx, ctx2);
@@ -1672,7 +1672,7 @@ int librados::IoCtxImpl::watch(const object_t& oid, uint64_t *handle,
   prepare_assert_ops(&wr);
   wr.watch(*handle, CEPH_OSD_WATCH_OP_WATCH, timeout);
   bufferlist bl;
-  objecter->linger_watch(linger_op, wr,
+  objecter->linger_watch(linger_op.get(), wr,
                         snapc, ceph::real_clock::now(), bl,
                         &onfinish,
                         &objver);
@@ -1682,7 +1682,7 @@ int librados::IoCtxImpl::watch(const object_t& oid, uint64_t *handle,
   set_sync_op_version(objver);
 
   if (r < 0) {
-    objecter->linger_cancel(linger_op);
+    objecter->linger_cancel(linger_op.get());
     *handle = 0;
   }
 
@@ -1706,8 +1706,8 @@ int librados::IoCtxImpl::aio_watch(const object_t& oid,
                                    uint32_t timeout,
                                    bool internal)
 {
-  Objecter::LingerOp *linger_op = objecter->linger_register(oid, oloc,
-                                                            extra_op_flags);
+  boost::intrusive_ptr linger_op = objecter->linger_register(oid, oloc,
+                                                             extra_op_flags);
   c->io = this;
   Context *oncomplete = new C_aio_linger_Complete(c, linger_op, false);
 
@@ -1722,7 +1722,7 @@ int librados::IoCtxImpl::aio_watch(const object_t& oid,
   prepare_assert_ops(&wr);
   wr.watch(*handle, CEPH_OSD_WATCH_OP_WATCH, timeout);
   bufferlist bl;
-  objecter->linger_watch(linger_op, wr,
+  objecter->linger_watch(linger_op.get(), wr,
                          snapc, ceph::real_clock::now(), bl,
                          oncomplete, &c->objver);
 
@@ -1808,8 +1808,8 @@ int librados::IoCtxImpl::notify(const object_t& oid, bufferlist& bl,
                                bufferlist *preply_bl,
                                char **preply_buf, size_t *preply_buf_len)
 {
-  Objecter::LingerOp *linger_op = objecter->linger_register(oid, oloc,
-                                                            extra_op_flags);
+  boost::intrusive_ptr linger_op = objecter->linger_register(oid, oloc,
+                                                             extra_op_flags);
 
   C_SaferCond notify_finish_cond;
   auto e = boost::asio::prefer(
@@ -1819,7 +1819,7 @@ int librados::IoCtxImpl::notify(const object_t& oid, bufferlist& bl,
     boost::asio::bind_executor(
       std::move(e),
       CB_notify_Finish(client->cct, &notify_finish_cond,
-                       objecter, linger_op, preply_bl,
+                       objecter, linger_op.get(), preply_bl,
                        preply_buf, preply_buf_len));
   uint32_t timeout = notify_timeout;
   if (timeout_ms)
@@ -1834,7 +1834,7 @@ int librados::IoCtxImpl::notify(const object_t& oid, bufferlist& bl,
   // Issue RADOS op
   C_SaferCond onack;
   version_t objver;
-  objecter->linger_notify(linger_op,
+  objecter->linger_notify(linger_op.get(),
                          rd, snap_seq, inbl, NULL,
                          &onack, &objver);
 
@@ -1854,7 +1854,7 @@ int librados::IoCtxImpl::notify(const object_t& oid, bufferlist& bl,
     notify_finish_cond.wait();
   }
 
-  objecter->linger_cancel(linger_op);
+  objecter->linger_cancel(linger_op.get());
 
   set_sync_op_version(objver);
   return r;
@@ -1865,8 +1865,8 @@ int librados::IoCtxImpl::aio_notify(const object_t& oid, AioCompletionImpl *c,
                                     bufferlist *preply_bl, char **preply_buf,
                                     size_t *preply_buf_len)
 {
-  Objecter::LingerOp *linger_op = objecter->linger_register(oid, oloc,
-                                                            extra_op_flags);
+  boost::intrusive_ptr linger_op = objecter->linger_register(oid, oloc,
+                                                             extra_op_flags);
 
   c->io = this;
 
@@ -1878,7 +1878,7 @@ int librados::IoCtxImpl::aio_notify(const object_t& oid, AioCompletionImpl *c,
     boost::asio::bind_executor(
       std::move(e),
       CB_notify_Finish(client->cct, oncomplete,
-                       objecter, linger_op,
+                       objecter, linger_op.get(),
                        preply_bl, preply_buf,
                        preply_buf_len));
   Context *onack = new C_aio_notify_Ack(client->cct, oncomplete);
@@ -1894,7 +1894,7 @@ int librados::IoCtxImpl::aio_notify(const object_t& oid, AioCompletionImpl *c,
   rd.notify(linger_op->get_cookie(), 1, timeout, bl, &inbl);
 
   // Issue RADOS op
-  objecter->linger_notify(linger_op,
+  objecter->linger_notify(linger_op.get(),
                          rd, snap_seq, inbl, NULL,
                          onack, &c->objver);
   return 0;
index 7b7c3f56e356cd551173654826fe6df46daa6a5c..8959754c15563816eb76d025ef8986379a97e264 100644 (file)
@@ -1758,7 +1758,7 @@ void RADOS::notify_(Object o, IOContext _ioc, bufferlist bl,
     bl, &inbl);
 
   impl->objecter->linger_notify(
-    linger_op, rd, ioc->snap_seq, inbl,
+    linger_op.get(), rd, ioc->snap_seq, inbl,
     asio::bind_executor(
       e,
       [cb](bs::error_code ec, ceph::bufferlist bl) mutable {
index ec68614364325b06a90ae03bdfd9ec449c1e5c85..e68c265a7b21a8ed53533ad1e801337594cddfec 100644 (file)
@@ -830,9 +830,10 @@ auto Objecter::_linger_by_cookie(uint64_t cookie)
   return info;
 }
 
-Objecter::LingerOp *Objecter::linger_register(const object_t& oid,
-                                             const object_locator_t& oloc,
-                                             int flags)
+auto Objecter::linger_register(const object_t& oid,
+                              const object_locator_t& oloc,
+                              int flags)
+  -> boost::intrusive_ptr<LingerOp>
 {
   unique_lock l(rwlock);
   // Acquire linger ID
index b3ab73281fe12fb315d125deabb72e7978e1853f..b4e5a84e2b94ebb24a148c2f1ea5400df602c543 100644 (file)
@@ -3211,8 +3211,9 @@ public:
   }
 
   // caller owns a ref
-  LingerOp *linger_register(const object_t& oid, const object_locator_t& oloc,
-                           int flags);
+  auto linger_register(const object_t& oid, const object_locator_t& oloc,
+                      int flags)
+      -> boost::intrusive_ptr<LingerOp>;
   ceph_tid_t linger_watch(LingerOp *info,
                          ObjectOperation& op,
                          const SnapContext& snapc, ceph::real_time mtime,