Skip to content

Commit

Permalink
Merge pull request #20028 from mogeb/steady-clock-rados
Browse files Browse the repository at this point in the history
rados: use WaitInterval()'s return value instead of manual timing

Reviewed-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Jan 22, 2018
2 parents ffe3eb1 + 6d4d26f commit 6f7e54d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/librados/RadosClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -550,14 +550,12 @@ int librados::RadosClient::wait_for_osdmap()

if (objecter->with_osdmap(std::mem_fn(&OSDMap::get_epoch)) == 0) {
ldout(cct, 10) << __func__ << " waiting" << dendl;
utime_t start = ceph_clock_now();
while (objecter->with_osdmap(std::mem_fn(&OSDMap::get_epoch)) == 0) {
if (timeout.is_zero()) {
cond.Wait(lock);
} else {
cond.WaitInterval(lock, timeout);
utime_t elapsed = ceph_clock_now() - start;
if (elapsed > timeout) {
int r = cond.WaitInterval(lock, timeout);
if (r == ETIMEDOUT) {
lderr(cct) << "timed out waiting for first osdmap from monitors"
<< dendl;
return -ETIMEDOUT;
Expand Down

0 comments on commit 6f7e54d

Please sign in to comment.