]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: object write should not exceed part size 2143/head
authorYehuda Sadeh <yehuda@redhat.com>
Thu, 24 Jul 2014 22:30:27 +0000 (15:30 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 25 Jul 2014 18:35:10 +0000 (11:35 -0700)
Fixes: #8928
This can happen if the stripe size is not a multiple of the chunk size.

Backport: firefly

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_rados.cc

index e8b95b3bb416984933b5f4f53752adc1db7ab02c..c5b558b22cbe79979edfa7019ba90117a95819e0 100644 (file)
@@ -1044,11 +1044,13 @@ int RGWPutObjProcessor_Atomic::handle_data(bufferlist& bl, off_t ofs, void **pha
     }
   }
 
+  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_chunk_size)
+  if (pending_data_bl.length() < max_write_size)
     return 0;
 
-  pending_data_bl.splice(0, max_chunk_size, &bl);
+  pending_data_bl.splice(0, max_write_size, &bl);
 
   if (!data_ofs && !immutable_head()) {
     first_chunk.claim(bl);