]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_file: unify allocations of request id 28648/head
authorMatt Benjamin <mbenjamin@redhat.com>
Wed, 15 May 2019 13:31:03 +0000 (09:31 -0400)
committerPrashant D <pdhange@redhat.com>
Tue, 18 Jun 2019 23:10:27 +0000 (19:10 -0400)
The fix by Tao Chen <chentao@umcloud.com> 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 <mbenjamin@redhat.com>
(cherry picked from commit 51356347a3400bbf7ea846c3e1196aeb7be0ab60)

src/rgw/librgw.cc
src/rgw/rgw_file.h
src/rgw/rgw_lib.h

index 95692aa7c460c2711973b862106f7ee28c6a60a9..5e8578f0baf9ac39f83381fa02374c1f467b6b76 100644 (file)
@@ -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
index 743ea55393678a8f2a46361e2dfb9817c0436d55..c0a78ee799f0f215b686fca3050cb0de7c6d157a 100644 (file)
@@ -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) {
index 962e84cbc4c7c29346515e71794f3666d526980b..9afd8d13272df20a006178d8192b2e1e14feba73 100644 (file)
@@ -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)
       {