]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge pull request #12010 from zhangsw/fix-rgw-multipart-bug
authorYehuda Sadeh <yehuda@redhat.com>
Thu, 13 Jul 2017 16:19:36 +0000 (09:19 -0700)
committerGitHub <noreply@github.com>
Thu, 13 Jul 2017 16:19:36 +0000 (09:19 -0700)
rgw: Fix a bug that multipart upload may exceed the quota.

Reviewed-by: Yehuda Sadeh <yehuda@redhat.com>
1  2 
src/rgw/rgw_rados.cc

index aeba9908fee23856add269aff33aae1a775c654a,78a68cf65c204dfbcec67542e48da7fd0f0ff1ae..2d9b550419df154396f927da91627cb94116e481
@@@ -6841,13 -6340,23 +6841,20 @@@ int RGWRados::Object::Write::_do_write_
    if (!op.size())
      return 0;
  
 -  string index_tag;
    uint64_t epoch;
    int64_t poolid;
-   bool orig_exists = state->exists;
-   uint64_t orig_size = state->accounted_size;
+   bool orig_exists;
+   uint64_t orig_size;
+   
+   if (!reset_obj) {    //Multipart upload, it has immutable head. 
+     orig_exists = false;
+     orig_size = 0;
+   } else {
+     orig_exists = state->exists;
+     orig_size = state->accounted_size;
+   }
  
 -  bool versioned_target = (meta.olh_epoch > 0 || !obj.get_instance().empty());
 -
 -  index_tag = state->write_tag;
 +  bool versioned_target = (meta.olh_epoch > 0 || !obj.key.instance.empty());
  
    bool versioned_op = (target->versioning_enabled() || is_olh || versioned_target);