From: GaryHyg Date: Mon, 7 Oct 2019 02:17:34 +0000 (+0800) Subject: rgw: dmclock: wait until the request is handled. X-Git-Tag: v15.1.1~615^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ec507626624a66a3a81d7ea65d0b8d78d9b8a221;p=ceph.git rgw: dmclock: wait until the request is handled. Fixes: https://tracker.ceph.com/issues/42217 Signed-off-by: GaryHyg --- diff --git a/src/rgw/rgw_dmclock_sync_scheduler.cc b/src/rgw/rgw_dmclock_sync_scheduler.cc index 367fb30c1b20b..06857202f3121 100644 --- a/src/rgw/rgw_dmclock_sync_scheduler.cc +++ b/src/rgw/rgw_dmclock_sync_scheduler.cc @@ -27,8 +27,9 @@ int SyncScheduler::add_request(const client_id& client, const ReqParams& params, } queue.request_completed(); // Perform a blocking wait until the request callback is called - if (std::unique_lock lk(req_mtx); rstate != ReqState::Wait) { - req_cv.wait(lk, [&rstate] {return rstate != ReqState::Wait;}); + { + std::unique_lock lock{req_mtx}; + req_cv.wait(lock, [&rstate] {return rstate != ReqState::Wait;}); } if (rstate == ReqState::Cancelled) { //FIXME: decide on error code for cancelled request