Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgw: retry CORS put/delete operations on ECANCELLED #19601

Merged
merged 1 commit into from Dec 22, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
56 changes: 30 additions & 26 deletions src/rgw/rgw_op.cc
Expand Up @@ -5023,9 +5023,11 @@ void RGWPutCORS::execute()
}
}

map<string, bufferlist> attrs = s->bucket_attrs;
attrs[RGW_ATTR_CORS] = cors_bl;
op_ret = rgw_bucket_set_attrs(store, s->bucket_info, attrs, &s->bucket_info.objv_tracker);
op_ret = retry_raced_bucket_write(store, s, [this] {
map<string, bufferlist> attrs = s->bucket_attrs;
attrs[RGW_ATTR_CORS] = cors_bl;
return rgw_bucket_set_attrs(store, s->bucket_info, attrs, &s->bucket_info.objv_tracker);
});
}

int RGWDeleteCORS::verify_permission()
Expand All @@ -5036,33 +5038,35 @@ int RGWDeleteCORS::verify_permission()

void RGWDeleteCORS::execute()
{
op_ret = read_bucket_cors();
if (op_ret < 0)
return;
op_ret = retry_raced_bucket_write(store, s, [this] {
op_ret = read_bucket_cors();
if (op_ret < 0)
return op_ret;

rgw_raw_obj obj;
if (!cors_exist) {
dout(2) << "No CORS configuration set yet for this bucket" << dendl;
op_ret = -ENOENT;
return;
}
store->get_bucket_instance_obj(s->bucket, obj);
store->set_prefetch_data(s->obj_ctx, obj);
map<string, bufferlist> attrs;
map<string, bufferlist>::iterator iter;
rgw_raw_obj obj;
if (!cors_exist) {
dout(2) << "No CORS configuration set yet for this bucket" << dendl;
op_ret = -ENOENT;
return op_ret;
}
store->get_bucket_instance_obj(s->bucket, obj);
store->set_prefetch_data(s->obj_ctx, obj);
map<string, bufferlist> attrs;
map<string, bufferlist>::iterator iter;

op_ret = get_system_obj_attrs(store, s, obj, attrs, NULL, &s->bucket_info.objv_tracker);
if (op_ret < 0)
return;
op_ret = get_system_obj_attrs(store, s, obj, attrs, NULL, &s->bucket_info.objv_tracker);
if (op_ret < 0)
return op_ret;

attrs.erase(RGW_ATTR_CORS);
op_ret = rgw_bucket_set_attrs(store, s->bucket_info, attrs,
attrs.erase(RGW_ATTR_CORS);
op_ret = rgw_bucket_set_attrs(store, s->bucket_info, attrs,
&s->bucket_info.objv_tracker);
if (op_ret < 0) {
ldout(s->cct, 0) << "RGWLC::RGWDeleteCORS() failed to set attrs on bucket=" << s->bucket.name
<< " returned err=" << op_ret << dendl;
return;
}
if (op_ret < 0) {
ldout(s->cct, 0) << "RGWLC::RGWDeleteCORS() failed to set attrs on bucket=" << s->bucket.name
<< " returned err=" << op_ret << dendl;
}
return op_ret;
});
}

void RGWOptionsCORS::get_response_params(string& hdrs, string& exp_hdrs, unsigned *max_age) {
Expand Down