]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
RGW: Multipart upload may double the quota
authorgaosibei <gaosb@inspur.com>
Tue, 26 Sep 2017 02:44:09 +0000 (10:44 +0800)
committergaosibei <gaosb@inspur.com>
Mon, 2 Oct 2017 03:49:12 +0000 (11:49 +0800)
Fixes: http://tracker.ceph.com/issues/21586
Signed-off-by: Sibei Gao <gaosb@inspur.com>
src/rgw/rgw_op.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index 39a5dee9b7158b292394870537b776fefa121307..fb58ea8d00289c2481d0e975ea76fc24a599dfb2 100644 (file)
@@ -5522,6 +5522,7 @@ void RGWCompleteMultipart::execute()
   obj_op.meta.owner = s->owner.get_id();
   obj_op.meta.flags = PUT_OBJ_CREATE;
   obj_op.meta.modify_tail = true;
+  obj_op.meta.completeMultipart = true;
   op_ret = obj_op.write_meta(ofs, accounted_size, attrs);
   if (op_ret < 0)
     return;
index 09d38c5111f4e62c2914d97d711540e28aedbe9e..b9181d47359af4af0989340b721c086953557e44 100644 (file)
@@ -6972,8 +6972,14 @@ int RGWRados::Object::Write::_do_write_meta(uint64_t size, uint64_t accounted_si
   meta.canceled = false;
 
   /* update quota cache */
-  store->quota_handler->update_stats(meta.owner, obj.bucket, (orig_exists ? 0 : 1),
-                                     accounted_size, orig_size);
+  if (meta.completeMultipart){
+       store->quota_handler->update_stats(meta.owner, obj.bucket, (orig_exists ? 0 : 1),
+                                     0, orig_size);
+  }
+  else {
+    store->quota_handler->update_stats(meta.owner, obj.bucket, (orig_exists ? 0 : 1),
+                                     accounted_size, orig_size);  
+  }
   return 0;
 
 done_cancel:
index df6be91e93931d256f2aad93f24210b83821cc22..220aa5e90a2f3b14953102661112161e9b31b6b4 100644 (file)
@@ -2815,11 +2815,12 @@ public:
         const string *user_data;
         rgw_zone_set *zones_trace;
         bool modify_tail;
+        bool completeMultipart;
 
         MetaParams() : mtime(NULL), rmattrs(NULL), data(NULL), manifest(NULL), ptag(NULL),
                  remove_objs(NULL), category(RGW_OBJ_CATEGORY_MAIN), flags(0),
                  if_match(NULL), if_nomatch(NULL), olh_epoch(0), canceled(false), user_data(nullptr), zones_trace(nullptr),
-                 modify_tail(false) {}
+                 modify_tail(false),  completeMultipart(false) {}
       } meta;
 
       explicit Write(RGWRados::Object *_target) : target(_target) {}