]> git-server-git.apps.pok.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>
Wed, 27 Aug 2014 17:29:41 +0000 (10:29 -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>
src/rgw/rgw_rados.cc

index 89f55ff7109770f667e0cba98667921b7feaafc8..e903736c51539f55d00f48a1fdd94e8c1c4eae94 100644 (file)
@@ -1079,7 +1079,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;
 }