Skip to content

Commit

Permalink
rgw: create thread_pipe before RGWHTTPManager::ReqsThread
Browse files Browse the repository at this point in the history
closes a potential race between pipe creation and
RGWHTTPManager::reqs_thread_entry()'s access of thread_pipe

Signed-off-by: Casey Bodley <cbodley@redhat.com>
  • Loading branch information
cbodley committed May 13, 2016
1 parent ab42bc5 commit 9161e9f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/rgw/rgw_http_client.cc
Expand Up @@ -694,16 +694,16 @@ int RGWHTTPManager::complete_requests()

int RGWHTTPManager::set_threaded()
{
is_threaded = true;
reqs_thread = new ReqsThread(this);
reqs_thread->create("http_manager");

int r = pipe(thread_pipe);
if (r < 0) {
r = -errno;
ldout(cct, 0) << "ERROR: pipe() returned errno=" << r << dendl;
return r;
}

is_threaded = true;
reqs_thread = new ReqsThread(this);
reqs_thread->create("http_manager");
return 0;
}

Expand Down

0 comments on commit 9161e9f

Please sign in to comment.