chain.push_obj(bucket.data_pool, key, loc);
}
- string tag = state->obj_tag.c_str();
+ string tag = (state->obj_tag.c_str() ? state->obj_tag.c_str() : "");
int ret = store->gc->send_chain(chain, tag, false); // do it async
return ret;
if (r < 0)
return r;
+ uint64_t obj_size = state->size;
+
ObjectWriteOperation op;
r = target->prepare_atomic_modification(op, false, NULL, NULL, NULL, true);
store->remove_rgw_head_obj(op);
r = ref.ioctx.operate(ref.oid, &op);
+ bool need_invalidate = false;
if (r == -ECANCELED) {
/* raced with another operation, we can regard it as removed */
- state->clear();
+ need_invalidate = true;
r = 0;
}
bool removed = (r >= 0);
/* other than that, no need to propagate error */
}
+ if (need_invalidate) {
+ target->invalidate_state();
+ }
+
if (r < 0)
return r;
if (ret_not_existed)
return -ENOENT;
- if (state) {
- /* update quota cache */
- store->quota_handler->update_stats(params.bucket_owner, bucket, -1, 0, state->size);
- }
+ /* update quota cache */
+ store->quota_handler->update_stats(params.bucket_owner, bucket, -1, 0, obj_size);
return 0;
}