]> git.apps.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, 14 Sep 2023 21:48:00 +0000 (17:48 -0400)
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 1be69580db980ebc784085b94ea8fe2e7c8f2392..2279288c9c34750252130b039eb848356e5a2aa3 100644 (file)
@@ -1677,7 +1677,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(
@@ -1853,7 +1853,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 0c7d0f7f8e0a5911a32c7597de73374e3a41a5d1..278eaee7f0039f58f1505fec2c7e79bf9eae10ec 100644 (file)
@@ -1494,8 +1494,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);
       });
   }
@@ -1513,7 +1514,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);
@@ -1533,9 +1534,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(