mirror of
https://github.com/ceph/ceph
synced 2025-02-24 11:37:37 +00:00
Merge pull request #29553 from cbodley/wip-rgw-http-unlock-suspend
rgw: http client drops lock before suspending coroutine Reviewed-by: Yuval Lifshitz <yuvalif@yahoo.com>
This commit is contained in:
commit
456fd7c1c1
@ -60,12 +60,14 @@ struct rgw_http_req_data : public RefCountedObject {
|
||||
auto async_wait(ExecutionContext& ctx, CompletionToken&& token) {
|
||||
boost::asio::async_completion<CompletionToken, Signature> init(token);
|
||||
auto& handler = init.completion_handler;
|
||||
completion = Completion::create(ctx.get_executor(), std::move(handler));
|
||||
{
|
||||
std::unique_lock l{lock};
|
||||
completion = Completion::create(ctx.get_executor(), std::move(handler));
|
||||
}
|
||||
return init.result.get();
|
||||
}
|
||||
|
||||
int wait(optional_yield y) {
|
||||
std::unique_lock l{lock};
|
||||
if (done) {
|
||||
return ret;
|
||||
}
|
||||
@ -82,6 +84,7 @@ struct rgw_http_req_data : public RefCountedObject {
|
||||
dout(20) << "WARNING: blocking http request" << dendl;
|
||||
}
|
||||
#endif
|
||||
std::unique_lock l{lock};
|
||||
cond.wait(l);
|
||||
return ret;
|
||||
}
|
||||
@ -108,12 +111,7 @@ struct rgw_http_req_data : public RefCountedObject {
|
||||
}
|
||||
}
|
||||
|
||||
bool _is_done() {
|
||||
return done;
|
||||
}
|
||||
|
||||
bool is_done() {
|
||||
std::lock_guard l{lock};
|
||||
return done;
|
||||
}
|
||||
|
||||
@ -895,7 +893,7 @@ void RGWHTTPManager::_unlink_request(rgw_http_req_data *req_data)
|
||||
if (req_data->curl_handle) {
|
||||
curl_multi_remove_handle((CURLM *)multi_handle, req_data->get_easy_handle());
|
||||
}
|
||||
if (!req_data->_is_done()) {
|
||||
if (!req_data->is_done()) {
|
||||
_finish_request(req_data, -ECANCELED);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user