]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: RGWHTTPManager, avoid referring to req_data->client when completing
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 3 May 2016 19:00:46 +0000 (12:00 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Mon, 9 May 2016 21:36:40 +0000 (14:36 -0700)
this is past calling req_data->finish(), client can be destroyed by now

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_http_client.cc

index 80f3e4e131445461c6f2407ab6943f23c943ce3c..bcb6250b51299c1ed204ce60cf8d67df6f053006 100644 (file)
@@ -138,13 +138,15 @@ struct rgw_http_req_data : public RefCountedObject {
   int ret;
   atomic_t done;
   RGWHTTPClient *client;
+  void *user_info;
   RGWHTTPManager *mgr;
   char error_buf[CURL_ERROR_SIZE];
 
   Mutex lock;
   Cond cond;
 
-  rgw_http_req_data() : easy_handle(NULL), h(NULL), id(-1), ret(0), client(NULL),
+  rgw_http_req_data() : easy_handle(NULL), h(NULL), id(-1), ret(0),
+                        client(nullptr), user_info(nullptr),
                         mgr(NULL), lock("rgw_http_req_data::lock") {
     memset(error_buf, 0, sizeof(error_buf));
   }
@@ -386,7 +388,7 @@ void RGWHTTPManager::_complete_request(rgw_http_req_data *req_data)
     reqs.erase(iter);
   }
   if (completion_mgr) {
-    completion_mgr->complete(NULL, req_data->client->get_user_info());
+    completion_mgr->complete(NULL, req_data->user_info);
   }
   req_data->put();
 }
@@ -461,6 +463,7 @@ int RGWHTTPManager::add_request(RGWHTTPClient *client, const char *method, const
 
   req_data->mgr = this;
   req_data->client = client;
+  req_data->user_info = client->get_user_info();
 
   register_request(req_data);