From ffe95d3c11f05937109b72e8e54c0cfb7dc09a36 Mon Sep 17 00:00:00 2001 From: Zhang Shaowen Date: Wed, 16 Nov 2016 10:52:54 +0800 Subject: [PATCH] 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 --- src/rgw/rgw_rados.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 352c87e7b7f..78a68cf65c2 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()); -- 2.39.5