From: Adam Kupczyk Date: Fri, 30 Sep 2016 09:31:13 +0000 (+0200) Subject: Fixed possible problems when compression expands data. X-Git-Tag: v11.1.0~429^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=99fd03bb12913323b5554b71098410a7aa677593;p=ceph.git Fixed possible problems when compression expands data. Signed-off-by: Adam Kupczyk --- diff --git a/src/rgw/rgw_compression.cc b/src/rgw/rgw_compression.cc index b58c0cd94e64..ee4d46036906 100644 --- a/src/rgw/rgw_compression.cc +++ b/src/rgw/rgw_compression.cc @@ -11,7 +11,9 @@ int RGWPutObj_Compress::handle_data(bufferlist& bl, off_t ofs, void **phandle, rgw_obj *pobj, bool *again) { bufferlist in_bl; - + if (*again) { + return next->handle_data(in_bl, ofs, phandle, pobj, again); + } if (bl.length() > 0) { // compression stuff if ((ofs > 0 && compressed) || // if previous part was compressed @@ -57,7 +59,6 @@ int RGWPutObj_Compress::handle_data(bufferlist& bl, off_t ofs, void **phandle, r } // end of compression stuff } - return next->handle_data(in_bl, ofs, phandle, pobj, again); } @@ -131,6 +132,7 @@ int RGWGetObj_Decompress::handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len first_data = false; cur_ofs += bl_len; + return next->handle_data(out_bl, bl_ofs, out_bl.length() - bl_ofs); } diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h index ad8cb914b4b5..60295e7739ed 100644 --- a/src/rgw/rgw_op.h +++ b/src/rgw/rgw_op.h @@ -1602,8 +1602,7 @@ static inline int put_data_and_throttle(RGWPutObjDataProcessor *processor, bufferlist& data, off_t ofs, bool need_to_wait) { - bool again; - + bool again = false; do { void *handle; rgw_obj obj; diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 89b3b7f4bb93..d74d5d19e8c3 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -2365,13 +2365,14 @@ int RGWPutObjProcessor_Atomic::write_data(bufferlist& bl, off_t ofs, void **phan int RGWPutObjProcessor_Atomic::handle_data(bufferlist& bl, off_t ofs, void **phandle, rgw_obj *pobj, bool *again) { - *again = false; *phandle = NULL; uint64_t max_write_size = MIN(max_chunk_size, (uint64_t)next_part_ofs - data_ofs); pending_data_bl.claim_append(bl); - if (pending_data_bl.length() < max_write_size) + if (pending_data_bl.length() < max_write_size) { + *again = false; return 0; + } pending_data_bl.splice(0, max_write_size, &bl);