]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: create thread_pipe before RGWHTTPManager::ReqsThread
authorCasey Bodley <cbodley@redhat.com>
Fri, 13 May 2016 17:01:38 +0000 (13:01 -0400)
committerCasey Bodley <cbodley@redhat.com>
Wed, 9 Nov 2016 15:29:21 +0000 (10:29 -0500)
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>
(cherry picked from commit 9161e9fdbfb2aa529a87197ef1a34f03917b80d9)

src/rgw/rgw_http_client.cc

index 283886a41ec19892afe33bf44eb5cae0dc7598f9..2ebbb417c03654371356be38aaae311d69bbfe94 100644 (file)
@@ -707,16 +707,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;
 }