]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: when you abort a multipart upload request, the quota will not update 33268/head
authorRichard Bai(白学余) <baixueyu@inspur.com>
Tue, 13 Aug 2019 12:56:55 +0000 (20:56 +0800)
committerNathan Cutler <ncutler@suse.com>
Thu, 13 Feb 2020 13:34:52 +0000 (14:34 +0100)
Fixes: https://tracker.ceph.com/issues/41606
Signed-off-by: Richard Bai(白学余) <baixueyu@inspur.com>
(cherry picked from commit f61fda5d1b572828750d53b487e0aa7cfabdf2a8)

src/rgw/rgw_multi.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index 437ceea94c9ee47300a0b31815adfac32a5abe97..d055d98b4ba57e5fc76476ab300a0e5a5cf86590 100644 (file)
@@ -235,6 +235,7 @@ int abort_multipart_upload(RGWRados *store, CephContext *cct,
   bool truncated;
   int marker = 0;
   int ret;
+  uint64_t parts_accounted_size = 0;
 
   do {
     ret = list_multipart_parts(store, bucket_info, cct,
@@ -271,6 +272,7 @@ int abort_multipart_upload(RGWRados *store, CephContext *cct,
           remove_objs.push_back(key);
         }
       }
+      parts_accounted_size += obj_part.accounted_size;
     }
   } while (truncated);
 
@@ -288,6 +290,9 @@ int abort_multipart_upload(RGWRados *store, CephContext *cct,
   if (!remove_objs.empty()) {
     del_op.params.remove_objs = &remove_objs;
   }
+  
+  del_op.params.abortmp = true;
+  del_op.params.parts_accounted_size = parts_accounted_size;
 
   // and also remove the metadata obj
   ret = del_op.delete_obj();
index 0921e596d34d4fe477c3846697e95c4a1a8313a6..8129ca9c4d9e13ef75affb94307f4586c4e2aaa9 100644 (file)
@@ -5517,6 +5517,10 @@ int RGWRados::Object::Delete::delete_obj()
   }
   uint64_t obj_accounted_size = state->accounted_size;
 
+  if(params.abortmp) {
+    obj_accounted_size = params.parts_accounted_size;
+  }
+
   if (!real_clock::is_zero(params.expiration_time)) {
     bufferlist bl;
     real_time delete_at;
index deb8b55328d0dee550bf7b0f1c2c340b4597c3f2..69ee29ebf992d7f948760d1b4f85b26500dd570d 100644 (file)
@@ -1643,8 +1643,10 @@ public:
         ceph::real_time mtime; /* for setting delete marker mtime */
         bool high_precision_time;
         rgw_zone_set *zones_trace;
+       bool abortmp;
+       uint64_t parts_accounted_size;
 
-        DeleteParams() : versioning_status(0), olh_epoch(0), bilog_flags(0), remove_objs(NULL), high_precision_time(false), zones_trace(nullptr) {}
+        DeleteParams() : versioning_status(0), olh_epoch(0), bilog_flags(0), remove_objs(NULL), high_precision_time(false), zones_trace(nullptr), abortmp(false), parts_accounted_size(0) {}
       } params;
 
       struct DeleteResult {