]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.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)
committerCasey Bodley <cbodley@redhat.com>
Tue, 16 Dec 2025 15:55:32 +0000 (10:55 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/librados/IoCtxImpl.cc
src/neorados/RADOS.cc
src/osdc/Objecter.cc
src/osdc/Objecter.h

index 4496e60e3fb2f0d89bd04ed3cc6882b0d381fc5a..9c2d6ce2a9bbd9c5934ad0222b8f8791e3a669fc 100644 (file)
@@ -1662,8 +1662,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);
@@ -1673,7 +1673,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);
@@ -1683,7 +1683,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;
   }
 
@@ -1707,8 +1707,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);
 
@@ -1723,7 +1723,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);
 
@@ -1809,8 +1809,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(
@@ -1820,7 +1820,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)
@@ -1835,7 +1835,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);
 
@@ -1855,7 +1855,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;
@@ -1866,8 +1866,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;
 
@@ -1879,7 +1879,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);
@@ -1895,7 +1895,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 7c3ca744ad73a0a49796389e2cf0082d41b1b349..335c47043dc0c53a69ae8d1ce97cc2d18fc7f866 100644 (file)
@@ -1744,7 +1744,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 9fed91df23d9e5ea4b4422812bebd35d9f590c67..b90a7ecf50ee18286282fb8af34b3e054edb0e18 100644 (file)
@@ -833,9 +833,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 400596acb063acf9e9f840099ece05c54484d5db..b98987d7e0eadab5a067012ac34779d2eb31aa07 100644 (file)
@@ -3243,8 +3243,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,