From bf9a6a8e45f8f64283acac1b5240740625934b7b Mon Sep 17 00:00:00 2001 From: GaryHyg Date: Mon, 7 Oct 2019 10:17:34 +0800 Subject: [PATCH] rgw: dmclock: wait until the request is handled. Fixes: https://tracker.ceph.com/issues/42217 Signed-off-by: GaryHyg (cherry picked from commit ec507626624a66a3a81d7ea65d0b8d78d9b8a221) --- src/rgw/rgw_dmclock_sync_scheduler.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_dmclock_sync_scheduler.cc b/src/rgw/rgw_dmclock_sync_scheduler.cc index f1950f55cfb06..650a995d22945 100644 --- a/src/rgw/rgw_dmclock_sync_scheduler.cc +++ b/src/rgw/rgw_dmclock_sync_scheduler.cc @@ -24,8 +24,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 -- 2.39.5