From: Yehuda Sadeh Date: Thu, 13 Jul 2017 16:19:36 +0000 (-0700) Subject: Merge pull request #12010 from zhangsw/fix-rgw-multipart-bug X-Git-Tag: v12.1.1~39 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=df7fbbf1454305024d340d98bebf88314f7fe0c2;p=ceph.git Merge pull request #12010 from zhangsw/fix-rgw-multipart-bug rgw: Fix a bug that multipart upload may exceed the quota. Reviewed-by: Yehuda Sadeh --- df7fbbf1454305024d340d98bebf88314f7fe0c2 diff --cc src/rgw/rgw_rados.cc index aeba9908fee2,78a68cf65c20..2d9b550419df --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@@ -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);