From: Yehuda Sadeh Date: Tue, 18 Jun 2013 00:14:22 +0000 (-0700) Subject: rgw: fix inter-region copy (ofs wasn't correct) X-Git-Tag: v0.67-rc1~128^2~25^2~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7f63baa68c2334d9e47f1393ff868a90979f0bc2;p=ceph.git rgw: fix inter-region copy (ofs wasn't correct) Fixing an issue with data read. Since inter-region copy uses embedded metadata within the data input, we need to fix the ofs accordingly. Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index ff164b183de8..1b3db4b2ccef 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -620,19 +620,22 @@ int RGWPutObjProcessor_Atomic::handle_data(bufferlist& bl, off_t ofs, void **pha extra_data_bl.append(extra); extra_data_len -= extra_len; - if (bl.length() == 0) + if (bl.length() == 0) { return 0; + } + ofs = extra_data_bl.length(); } - if (!ofs && !immutable_head()) { + off_t actual_ofs = ofs - extra_data_bl.length(); + if (!actual_ofs && !immutable_head()) { first_chunk.claim(bl); *phandle = NULL; obj_len = (uint64_t)first_chunk.length(); prepare_next_part(first_chunk.length()); return 0; } - if (ofs >= next_part_ofs) - prepare_next_part(ofs); - int r = RGWPutObjProcessor_Aio::handle_obj_data(cur_obj, bl, ofs - cur_part_ofs, ofs, phandle); + if (actual_ofs >= next_part_ofs) + prepare_next_part(actual_ofs); + int r = RGWPutObjProcessor_Aio::handle_obj_data(cur_obj, bl, actual_ofs - cur_part_ofs, actual_ofs, phandle); return r; }