]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: clear bufferlist if write_data() successful
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 22 Aug 2014 04:53:38 +0000 (21:53 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 23 Sep 2014 20:26:33 +0000 (13:26 -0700)
Fixes: #9201
Backport: firefly

We sometimes need to call RGWPutObjProcessor::handle_data() again,
so that we send the pending data. However, we failed to clear the buffer
that was already sent, thus it was resent. This triggers when using non
default pool alignments.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
(cherry picked from commit 9181114d6f6062c55ee4b351fc3495345e545c36)

src/rgw/rgw_rados.cc

index e22bef0be04dbd3464567a5e52dd88546f2d5d17..d861e30c6da3581717174a0d78b6b9d753b74b9f 100644 (file)
@@ -1074,7 +1074,11 @@ int RGWPutObjProcessor_Atomic::handle_data(bufferlist& bl, off_t ofs, void **pha
   bool exclusive = (!write_ofs && immutable_head()); /* immutable head object, need to verify nothing exists there
                                                         we could be racing with another upload, to the same
                                                         object and cleanup can be messy */
-  return write_data(bl, write_ofs, phandle, exclusive);
+  int ret = write_data(bl, write_ofs, phandle, exclusive);
+  if (ret >= 0) { /* we might return, need to clear bl as it was already sent */
+    bl.clear();
+  }
+  return ret;
 }