rgw: Fix a bug that multipart upload may exceed the quota.
Reviewed-by: Yehuda Sadeh <yehuda@redhat.com>
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);