]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: restore buffer of multipart upload after EEXIST 4661/head
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 12 May 2015 23:40:10 +0000 (16:40 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Wed, 13 May 2015 00:23:35 +0000 (17:23 -0700)
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 <yehuda@redhat.com>
src/rgw/rgw_op.cc

index 35c27d8edbb716fe8602a28995dd4db967ccdaf6..77fb4e8bdebbdb9077e8cc4529c06fd9b67a8bf3 100644 (file)
@@ -1807,6 +1807,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) {
@@ -1816,6 +1822,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);