]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
RGW: Multipart upload may double the quota 18435/head
authorgaosibei <gaosb@inspur.com>
Tue, 26 Sep 2017 02:44:09 +0000 (10:44 +0800)
committerAbhishek Lekshmanan <abhishek@suse.com>
Fri, 20 Oct 2017 14:56:38 +0000 (16:56 +0200)
Fixes: http://tracker.ceph.com/issues/21586
Signed-off-by: Sibei Gao <gaosb@inspur.com>
(cherry picked from commit 97f95e457fb7f9e36031f41e0f2dd3955daedd87)

src/rgw/rgw_op.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index f7e5caf67f51dd45763bc8c3eec39391ab2ae005..d517827ce399f4abd6dc366fc745693f1c4f3647 100644 (file)
@@ -5508,6 +5508,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 5544b4e6038fded86bb67f014e062196dda7b62b..d16123c5d54af6f24b1c5531b624bca78f9df26d 100644 (file)
@@ -7009,8 +7009,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 6984192f0f497cdd999c63ada76ce236e3f43087..a9eb64c44521be7fb5d2fb70655c96103569c7a9 100644 (file)
@@ -2809,11 +2809,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) {}