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: v0.94.10~58^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=8f1c915fa47a889cb50cf84e2d1230df7443752c;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 5854c64dbf86d..9056eee7d330e 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -645,7 +645,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()) { @@ -4243,8 +4243,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 16ccfe0c09dfc..6679056fe613d 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -386,8 +386,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() {