From: Yehuda Sadeh Date: Thu, 7 Jul 2016 22:49:07 +0000 (-0700) Subject: rgw: adjust objs when copying obj with explicit_objs set X-Git-Tag: v10.2.4~109^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=77e497da5c618a30fb908cb3915aa1ca7279ce7f;p=ceph.git rgw: adjust objs when copying obj with explicit_objs set If the head object contains data, need to set it in the list of objs (in addition to being pointed at by head_obj). Signed-off-by: Yehuda Sadeh (cherry picked from commit 1e012112b99004745952accc6fb11ada5e8e0045) --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index a45eae97424..0219cac708d 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -1881,7 +1881,7 @@ int RGWObjManifest::generator::create_begin(CephContext *cct, RGWObjManifest *_m bucket = _b; manifest->set_tail_bucket(_b); - manifest->set_head(_h); + manifest->set_head(_h, 0); last_ofs = 0; if (manifest->get_prefix().empty()) { @@ -7051,8 +7051,7 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx, goto done_ret; } - pmanifest->set_head(dest_obj); - pmanifest->set_head_size(first_chunk.length()); + pmanifest->set_head(dest_obj, first_chunk.length()); } write_op.meta.data = &first_chunk; diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index c8f7c8a973b..3a10bff6d10 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -400,8 +400,14 @@ public: return (obj_size > head_size); } - void set_head(const rgw_obj& _o) { + void set_head(const rgw_obj& _o, uint64_t _s) { head_obj = _o; + head_size = _s; + + if (explicit_objs && head_size > 0) { + objs[0].loc = head_obj; + objs[0].size = head_size; + } } const rgw_obj& get_head() {