]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_file: fix some zipper flow for RGWLibContinuedReq 37967/head
authorMatt Benjamin <mbenjamin@redhat.com>
Wed, 4 Nov 2020 17:02:27 +0000 (12:02 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Thu, 5 Nov 2020 17:17:10 +0000 (12:17 -0500)
Some bits of the standard Zipper conversions were missed for
the RGWLibContinuedReq case, where the setup is encapsulated in
the request, but execution is broken up in to steps.   This
currently affects only RGWWriteRequest.

Fixes: https://tracker.ceph.com/issues/48136
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/librgw.cc
src/rgw/rgw_file.cc
src/rgw/rgw_file.h
src/rgw/rgw_lib.h

index 25f81690ca5075421c40da57df963c399b91b010..374b5b74acacb4cfe2d5ad019e4c366354004aa6 100644 (file)
@@ -371,9 +371,21 @@ namespace rgw {
     }
 
     struct req_state* s = req->get_state();
+    RGWLibIO& io_ctx = req->get_io();
+    RGWEnv& rgw_env = io_ctx.get_env();
+    RGWObjectCtx& rados_ctx = req->get_octx();
+
+    rgw_env.set("HTTP_HOST", "");
+
+    int ret = req->init(rgw_env, &rados_ctx, &io_ctx, s);
+    if (ret < 0) {
+      dout(10) << "failed to initialize request" << dendl;
+      abort_req(s, op, ret);
+      goto done;
+    }
 
     /* req is-a RGWOp, currently initialized separately */
-    int ret = req->op_init();
+    ret = req->op_init();
     if (ret < 0) {
       dout(10) << "failed to initialize RGWOp" << dendl;
       abort_req(s, op, ret);
@@ -460,6 +472,8 @@ namespace rgw {
            << " op status=" << op_ret
            << " ======" << dendl;
 
+    perfcounter->inc(l_rgw_req);
+
     return ret;
   }
 
index 37592bb6b8cc28404d77e9d4bc9e0ad0e58e250d..0e26e12e8202c37e2cc04c90bcc42796e90a7848 100644 (file)
@@ -1536,6 +1536,9 @@ namespace rgw {
   int RGWWriteRequest::exec_start() {
     struct req_state* state = get_state();
 
+    /* Object needs a bucket from this point */
+    state->object->set_bucket(state->bucket.get());
+
     auto compression_type =
       get_store()->svc()->zone->get_zone_params().get_compression_type(
        state->bucket->get_placement_rule());
index 9ec8a2955178c70e4b662e6454791f56bff7d762..fe9eec65bac6c738bbedeb86410b5b0ab19b5273 100644 (file)
@@ -2389,8 +2389,10 @@ public:
   size_t bytes_written;
   bool eio;
 
-  RGWWriteRequest(rgw::sal::RGWRadosStore* store, std::unique_ptr<rgw::sal::RGWUser> _user,
-                 RGWFileHandle* _fh, const std::string& _bname, const std::string& _oname)
+  RGWWriteRequest(rgw::sal::RGWRadosStore* store,
+                 std::unique_ptr<rgw::sal::RGWUser> _user,
+                 RGWFileHandle* _fh, const std::string& _bname,
+                 const std::string& _oname)
     : RGWLibContinuedReq(store->ctx(), std::move(_user)),
       bucket_name(_bname), obj_name(_oname),
       rgw_fh(_fh), filter(nullptr), timer_id(0), real_ofs(0),
index 1ddd372dc7123958898303ca736319ff7996523c..9b46a945b1ce7d265e77fba9a2ac427ce1181d7c 100644 (file)
@@ -192,7 +192,8 @@ namespace rgw {
     RGWObjectCtx rados_ctx;
   public:
 
-    RGWLibContinuedReq(CephContext* _cct, std::unique_ptr<rgw::sal::RGWUser> _user)
+    RGWLibContinuedReq(CephContext* _cct,
+                      std::unique_ptr<rgw::sal::RGWUser> _user)
       :  RGWLibRequest(_cct, std::move(_user)), io_ctx(),
         rstate(_cct, &io_ctx.get_env(), id),
         rados_ctx(rgwlib.get_store(), &rstate)
@@ -204,6 +205,7 @@ namespace rgw {
 
        sysobj_ctx.emplace(store->svc()->sysobj);
 
+       get_state()->cio = &io_ctx;
        get_state()->obj_ctx = &rados_ctx;
        get_state()->sysobj_ctx = &(sysobj_ctx.get());
        get_state()->req_id = store->svc()->zone_utils->unique_id(id);
@@ -214,6 +216,8 @@ namespace rgw {
       }
 
     inline rgw::sal::RGWRadosStore* get_store() { return store; }
+    inline RGWLibIO& get_io() { return io_ctx; }
+    inline RGWObjectCtx& get_octx() { return rados_ctx; }
 
     virtual int execute() final { ceph_abort(); }
     virtual int exec_start() = 0;