From: Yehuda Sadeh Date: Tue, 12 May 2015 23:40:10 +0000 (-0700) Subject: rgw: restore buffer of multipart upload after EEXIST X-Git-Tag: v0.80.10~11^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=eef3d2f1c400573db90936fd417769183950b6ee;p=ceph.git rgw: restore buffer of multipart upload after EEXIST Fixes #11604 Backport: hammer, firefly When we need to restart a write of part data, we need to revert to buffer to before the write, otherwise we're going to skip some data. Signed-off-by: Yehuda Sadeh (cherry picked from commit 580ccaec12daae64c38a1616d0be907bdd70a888) --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index d436e3a67e068..cc557d8b5d5e8 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -1627,6 +1627,12 @@ void RGWPutObj::execute() */ bool need_to_wait = (ofs == 0) && multipart; + bufferlist orig_data; + + if (need_to_wait) { + orig_data = data; + } + ret = put_data_and_throttle(processor, data, ofs, (need_calc_md5 ? &hash : NULL), need_to_wait); if (ret < 0) { if (!need_to_wait || ret != -EEXIST) { @@ -1636,6 +1642,9 @@ void RGWPutObj::execute() ldout(s->cct, 5) << "NOTICE: processor->throttle_data() returned -EEXIST, need to restart write" << dendl; + /* restore original data */ + data.swap(orig_data); + /* restart processing with different oid suffix */ dispose_processor(processor);