]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: dmclock: wait until the request is handled. 30777/head
authorGaryHyg <huygbj@inspur.com>
Mon, 7 Oct 2019 02:17:34 +0000 (10:17 +0800)
committerGaryHyg <huygbj@inspur.com>
Tue, 8 Oct 2019 09:26:05 +0000 (17:26 +0800)
Fixes: https://tracker.ceph.com/issues/42217
Signed-off-by: GaryHyg <huygbj@inspur.com>
src/rgw/rgw_dmclock_sync_scheduler.cc

index 367fb30c1b20b487f5fcc0cc3d615145f31a1d82..06857202f3121b0c8a0ec5d60368cd73e33f5291 100644 (file)
@@ -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<std::mutex> 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