From: Matt Benjamin Date: Wed, 15 May 2019 13:31:03 +0000 (-0400) Subject: rgw_file: unify allocations of request id X-Git-Tag: v15.1.0~2594^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=51356347a3400bbf7ea846c3e1196aeb7be0ab60;p=ceph.git rgw_file: unify allocations of request id The fix by Tao Chen for construction of the request id in RGWWriteRequests/RGWContinuedReq paths--just writes, effectively--revealed that RGWRequest::id was being set to zero in general, while a valid request id was being assigned to req_state. This implies that code which the RGWRequest::id of non-write requests would still use an invalid value, so avoid that by initializing RGWRequest::id in all RGWLibRequests, and propagating its value to req_state. This still works as intended for RGWWriteRequest. Signed-off-by: Matt Benjamin --- diff --git a/src/rgw/librgw.cc b/src/rgw/librgw.cc index 95692aa7c460..5e8578f0baf9 100644 --- a/src/rgw/librgw.cc +++ b/src/rgw/librgw.cc @@ -226,8 +226,7 @@ namespace rgw { rgw_env.set("HTTP_HOST", ""); /* XXX and -then- bloat up req_state with string copies from it */ - const uint64_t reqid = store->get_new_req_id(); - struct req_state rstate(req->cct, &rgw_env, req->get_user(), reqid); + struct req_state rstate(req->cct, &rgw_env, req->get_user(), req->id); struct req_state *s = &rstate; // XXX fix this diff --git a/src/rgw/rgw_file.h b/src/rgw/rgw_file.h index bbf7d3e2f7ac..fd562f51cb82 100644 --- a/src/rgw/rgw_file.h +++ b/src/rgw/rgw_file.h @@ -2365,7 +2365,7 @@ public: RGWWriteRequest(CephContext* _cct, RGWUserInfo *_user, RGWFileHandle* _fh, const std::string& _bname, const std::string& _oname) - : RGWLibContinuedReq(_cct, _user, rgwlib.get_store()->get_new_req_id()), + : RGWLibContinuedReq(_cct, _user), bucket_name(_bname), obj_name(_oname), rgw_fh(_fh), filter(nullptr), real_ofs(0), bytes_written(0), eio(false) { diff --git a/src/rgw/rgw_lib.h b/src/rgw/rgw_lib.h index 962e84cbc4c7..9afd8d13272d 100644 --- a/src/rgw/rgw_lib.h +++ b/src/rgw/rgw_lib.h @@ -134,8 +134,9 @@ namespace rgw { /* unambiguiously return req_state */ inline struct req_state* get_state() { return this->RGWRequest::s; } - RGWLibRequest(CephContext* _cct, RGWUserInfo* _user, uint64_t id = 0) - : RGWRequest(id), cct(_cct), user(_user) + RGWLibRequest(CephContext* _cct, RGWUserInfo* _user) + : RGWRequest(rgwlib.get_store()->get_new_req_id()), cct(_cct), + user(_user) {} RGWUserInfo* get_user() { return user; } @@ -189,8 +190,8 @@ namespace rgw { RGWObjectCtx rados_ctx; public: - RGWLibContinuedReq(CephContext* _cct, RGWUserInfo* _user, uint64_t id = 0) - : RGWLibRequest(_cct, _user, id), io_ctx(), + RGWLibContinuedReq(CephContext* _cct, RGWUserInfo* _user) + : RGWLibRequest(_cct, _user), io_ctx(), rstate(_cct, &io_ctx.get_env(), _user, id), rados_ctx(rgwlib.get_store(), &rstate) {