summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohamad Gebai <mgebai@suse.com>2017-11-30 18:58:39 +0100
committerMohamad Gebai <mgebai@suse.com>2018-05-21 20:34:55 +0200
commitadadde098766aa2e626294d9bf9b9bd74563401c (patch)
treec38c9ff19589e6f354fbf87b4e65f719c1500263
parentMerge PR #22091 into master (diff)
downloadceph-adadde098766aa2e626294d9bf9b9bd74563401c.tar.xz
ceph-adadde098766aa2e626294d9bf9b9bd74563401c.zip
librados: use steady clock for rados_mon_op_timeout
Signed-off-by: Mohamad Gebai <mgebai@suse.com>
-rw-r--r--src/librados/RadosClient.cc10
-rw-r--r--src/librados/RadosClient.h1
2 files changed, 7 insertions, 4 deletions
diff --git a/src/librados/RadosClient.cc b/src/librados/RadosClient.cc
index b94d3ef8772..f08883760eb 100644
--- a/src/librados/RadosClient.cc
+++ b/src/librados/RadosClient.cc
@@ -585,14 +585,16 @@ int librados::RadosClient::wait_for_osdmap()
if (need_map) {
Mutex::Locker l(lock);
- utime_t timeout;
- if (cct->_conf->rados_mon_op_timeout > 0)
- timeout.set_from_double(cct->_conf->rados_mon_op_timeout);
+ ceph::timespan timeout;
+ if (cct->_conf->rados_mon_op_timeout > 0) {
+ timeout = ceph::make_timespan(cct->_conf->rados_mon_op_timeout);
+ }
if (objecter->with_osdmap(std::mem_fn(&OSDMap::get_epoch)) == 0) {
ldout(cct, 10) << __func__ << " waiting" << dendl;
+ auto start = mono_clock::now();
while (objecter->with_osdmap(std::mem_fn(&OSDMap::get_epoch)) == 0) {
- if (timeout.is_zero()) {
+ if (timeout == timeout.zero()) {
cond.Wait(lock);
} else {
int r = cond.WaitInterval(lock, timeout);
diff --git a/src/librados/RadosClient.h b/src/librados/RadosClient.h
index bf4105d5184..a21f9785449 100644
--- a/src/librados/RadosClient.h
+++ b/src/librados/RadosClient.h
@@ -18,6 +18,7 @@
#include "common/Mutex.h"
#include "common/RWLock.h"
#include "common/Timer.h"
+#include "common/ceph_time.h"
#include "include/rados/librados.h"
#include "include/rados/librados.hpp"
#include "mon/MonClient.h"