From 2aaf49bd66c7f05e3e03c3cb2a45ebade5ac13f1 Mon Sep 17 00:00:00 2001 From: Adam Emerson Date: Fri, 8 Sep 2023 16:50:46 -0400 Subject: [PATCH] neorados: Notify fixes 1. Objecter expects a count of seconds, not milliseconds 2. Actually return result Signed-off-by: Adam Emerson --- src/include/neorados/RADOS.hpp | 4 ++-- src/neorados/RADOS.cc | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/include/neorados/RADOS.hpp b/src/include/neorados/RADOS.hpp index 1be69580db980..2279288c9c347 100644 --- a/src/include/neorados/RADOS.hpp +++ b/src/include/neorados/RADOS.hpp @@ -1677,7 +1677,7 @@ public: using NotifyComp = boost::asio::any_completion_handler; template CompletionToken> auto notify(Object o, IOContext ioc, ceph::buffer::list bl, - std::optional timeout, + std::optional timeout, CompletionToken&& token) { auto consigned = boost::asio::consign( std::forward(token), boost::asio::make_work_guard( @@ -1853,7 +1853,7 @@ private: SimpleOpComp); void notify_(Object oid, IOContext ioctx, ceph::buffer::list bl, - std::optional timeout, + std::optional timeout, NotifyComp c); void flush_watch_(VoidOpComp); diff --git a/src/neorados/RADOS.cc b/src/neorados/RADOS.cc index 0c7d0f7f8e0a5..278eaee7f0039 100644 --- a/src/neorados/RADOS.cc +++ b/src/neorados/RADOS.cc @@ -1494,8 +1494,9 @@ struct NotifyHandler : std::enable_shared_from_this { 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 { }; void RADOS::notify_(Object o, IOContext _ioc, bufferlist bl, - std::optional timeout, + std::optional timeout, NotifyComp c) { auto oid = reinterpret_cast(&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( -- 2.39.5