From: Zhang Shaowen Date: Wed, 16 Nov 2016 02:52:54 +0000 (+0800) Subject: rgw: Fix a bug that multipart upload may exceed the quota because of X-Git-Tag: v12.1.1~39^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ffe95d3c11f05937109b72e8e54c0cfb7dc09a36;p=ceph.git rgw: Fix a bug that multipart upload may exceed the quota because of improperly operation to the cache. Fixes: http://tracker.ceph.com/issues/19602 Signed-off-by: Zhang Shaowen --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 352c87e7b7fc..78a68cf65c20 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -6343,9 +6343,16 @@ int RGWRados::Object::Write::write_meta(uint64_t size, uint64_t accounted_size, 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());