From d73dbc3a39117eddaaabb2c25d9238cd7c51711b Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 21 Aug 2014 21:53:38 -0700 Subject: [PATCH] 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 (cherry picked from commit 9181114d6f6062c55ee4b351fc3495345e545c36) --- src/rgw/rgw_rados.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index e22bef0be04db..d861e30c6da35 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -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; } -- 2.39.5