Skip to content

Commit

Permalink
rgw: civetweb_callback() refer to store inside lock
Browse files Browse the repository at this point in the history
pe->store might change when reconfiguring

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
(cherry picked from commit 2ca38da)
  • Loading branch information
yehudasa committed May 9, 2016
1 parent 2f65b31 commit 2d0cd8a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/rgw/rgw_civetweb_frontend.cc
Expand Up @@ -8,17 +8,18 @@
static int civetweb_callback(struct mg_connection* conn) {
struct mg_request_info* req_info = mg_get_request_info(conn);
RGWMongooseEnv* pe = static_cast<RGWMongooseEnv *>(req_info->user_data);
RGWRados* store = pe->store;
RGWREST* rest = pe->rest;
OpsLogSocket* olog = pe->olog;

RGWRequest req(store->get_new_req_id());
RGWMongoose client_io(conn, pe->port);

{
// hold a read lock over access to pe->store for reconfiguration
RWLock::RLocker lock(pe->mutex);

RGWRados* store = pe->store;
RGWREST* rest = pe->rest;
OpsLogSocket* olog = pe->olog;

RGWRequest req(store->get_new_req_id());
RGWMongoose client_io(conn, pe->port);

int ret = process_request(pe->store, rest, &req, &client_io, olog);
if (ret < 0) {
/* we don't really care about return code */
Expand Down

0 comments on commit 2d0cd8a

Please sign in to comment.