From: Yehuda Sadeh Date: Fri, 22 Aug 2014 04:53:38 +0000 (-0700) Subject: rgw: clear bufferlist if write_data() successful X-Git-Tag: v0.85~8^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9181114d6f6062c55ee4b351fc3495345e545c36;p=ceph.git rgw: clear bufferlist if write_data() successful 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 --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 89f55ff71097..e903736c5153 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -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; }