Skip to content

Commit

Permalink
Merge pull request ceph#21767 from cfanz/wip-fix-rgw-race-condition
Browse files Browse the repository at this point in the history
rgw: avoid race condition in RGWHTTPClient::wait()
  • Loading branch information
mattbenjamin committed Oct 31, 2018
2 parents 223a24e + c1a43a1 commit 1b57df1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/rgw/rgw_http_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ struct rgw_http_req_data : public RefCountedObject {

int wait() {
Mutex::Locker l(lock);
if (done) {
return ret;
}
cond.Wait(lock);
return ret;
}
Expand Down Expand Up @@ -527,11 +530,7 @@ bool RGWHTTPClient::is_done()
*/
int RGWHTTPClient::wait()
{
if (!req_data->is_done()) {
return req_data->wait();
}

return req_data->ret;
return req_data->wait();
}

void RGWHTTPClient::cancel()
Expand Down

0 comments on commit 1b57df1

Please sign in to comment.