]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
neorados: Notify fixes
authorAdam Emerson <aemerson@redhat.com>
Fri, 8 Sep 2023 20:50:46 +0000 (16:50 -0400)
committerAdam Emerson <aemerson@redhat.com>
Thu, 7 Dec 2023 21:26:58 +0000 (16:26 -0500)
1. Objecter expects a count of seconds, not milliseconds
2. Actually return result

Signed-off-by: Adam Emerson <aemerson@redhat.com>
src/include/neorados/RADOS.hpp
src/neorados/RADOS.cc

index dbc4aff3c5ac77a3fcee391c7b8af9f85c84e8d6..a9c9cf1462db07978d867a9c2f662ada2c630039 100644 (file)
@@ -1670,7 +1670,7 @@ public:
   using NotifyComp = boost::asio::any_completion_handler<NotifySig>;
   template<boost::asio::completion_token_for<NotifySig> CompletionToken>
   auto notify(Object o, IOContext ioc, ceph::buffer::list bl,
-             std::optional<std::chrono::milliseconds> timeout,
+             std::optional<std::chrono::seconds> timeout,
              CompletionToken&& token) {
     auto consigned = boost::asio::consign(
       std::forward<CompletionToken>(token), boost::asio::make_work_guard(
@@ -1844,7 +1844,7 @@ private:
                SimpleOpComp);
   void notify_(Object oid, IOContext ioctx,
               ceph::buffer::list bl,
-              std::optional<std::chrono::milliseconds> timeout,
+              std::optional<std::chrono::seconds> timeout,
               NotifyComp c);
   void flush_watch_(VoidOpComp);
 
index 9b743f6e98624b56b9fb3ebb470a12b220c7c14a..3d97ead1ff7c614f61f68398124e9fddb2f85077 100644 (file)
@@ -1451,8 +1451,9 @@ struct NotifyHandler : std::enable_shared_from_this<NotifyHandler> {
                  bufferlist&& bl) {
     asio::post(
       strand,
-      [this, ec, p = shared_from_this()]() mutable {
+      [this, ec, bl = std::move(bl), p = shared_from_this()]() mutable {
        finished = true;
+       rbl = std::move(bl);
        maybe_cleanup(ec);
       });
   }
@@ -1470,7 +1471,7 @@ struct NotifyHandler : std::enable_shared_from_this<NotifyHandler> {
 };
 
 void RADOS::notify_(Object o, IOContext _ioc, bufferlist bl,
-                   std::optional<std::chrono::milliseconds> timeout,
+                   std::optional<std::chrono::seconds> timeout,
                    NotifyComp c)
 {
   auto oid = reinterpret_cast<const object_t*>(&o.impl);
@@ -1490,9 +1491,11 @@ void RADOS::notify_(Object o, IOContext _ioc, bufferlist bl,
       });
   ObjectOperation rd;
   bufferlist inbl;
+  // 30s is the default in librados. Use that rather than borrowing from CephFS.
+  // TODO add a config option later.
   rd.notify(
     linger_op->get_cookie(), 1,
-    timeout ? timeout->count() : impl->cct->_conf->client_notify_timeout,
+    timeout.value_or(30s).count(),
     bl, &inbl);
 
   impl->objecter->linger_notify(