]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Fixed possible problems when compression expands data.
authorAdam Kupczyk <akupczyk@mirantis.com>
Fri, 30 Sep 2016 09:31:13 +0000 (11:31 +0200)
committerAdam Kupczyk <akupczyk@mirantis.com>
Wed, 2 Nov 2016 11:13:06 +0000 (12:13 +0100)
Signed-off-by: Adam Kupczyk <akupczyk@mirantis.com>
src/rgw/rgw_compression.cc
src/rgw/rgw_op.h
src/rgw/rgw_rados.cc

index b58c0cd94e64a7a271b1fd5d03810447df7b85f4..ee4d460369069510f788e3a790911c8c85afe71b 100644 (file)
@@ -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);
 }
 
index ad8cb914b4b5fd58cc9ade19d395a763b05bdef2..60295e7739edadb91fbcca3855c605adba72c965 100644 (file)
@@ -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;
index 89b3b7f4bb93338bcf77fae6f862e315f4e6f9d2..d74d5d19e8c3a6010d9b073abe4556e44d62128d 100644 (file)
@@ -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);