]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: dmclock: wait until the request is handled. 34954/head
authorGaryHyg <huygbj@inspur.com>
Mon, 7 Oct 2019 02:17:34 +0000 (10:17 +0800)
committerNathan Cutler <ncutler@suse.com>
Thu, 7 May 2020 15:37:26 +0000 (17:37 +0200)
Fixes: https://tracker.ceph.com/issues/42217
Signed-off-by: GaryHyg <huygbj@inspur.com>
(cherry picked from commit ec507626624a66a3a81d7ea65d0b8d78d9b8a221)

src/rgw/rgw_dmclock_sync_scheduler.cc

index f1950f55cfb064c9a0433807fc4bca128852e34e..650a995d229452dd38db06b2115d11f3b62edcf8 100644 (file)
@@ -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<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