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

jewel: rgw: account/container metadata not actually present in a request are deleted during POST through Swift API #9542

Merged
merged 2 commits into from Jun 30, 2016
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
20 changes: 18 additions & 2 deletions src/rgw/rgw_op.cc
Expand Up @@ -1856,6 +1856,10 @@ static void prepare_add_del_attrs(const map<string, bufferlist>& orig_attrs,
if (aiter != std::end(out_attrs)) {
out_attrs.erase(aiter);
}
} else {
/* emplace() won't alter the map if the key is already present.
* This behaviour is fully intensional here. */
out_attrs.emplace(kv);
}
} else if (out_attrs.find(name) == std::end(out_attrs)) {
out_attrs[name] = kv.second;
Expand Down Expand Up @@ -2773,11 +2777,23 @@ void RGWPutMetadataAccount::execute()
return;
}

op_ret = rgw_get_user_attrs_by_uid(store, s->user->user_id, orig_attrs,
&acct_op_tracker);
if (op_ret < 0) {
return;
}

rgw_get_request_metadata(s->cct, s->info, attrs, false);
RGWUserInfo orig_uinfo;
rgw_get_user_info_by_uid(store, s->user->user_id, orig_uinfo, &acct_op_tracker);
prepare_add_del_attrs(orig_attrs, rmattr_names, attrs);
populate_with_generic_attrs(s, attrs);

RGWUserInfo orig_uinfo;
op_ret = rgw_get_user_info_by_uid(store, s->user->user_id, orig_uinfo,
&acct_op_tracker);
if (op_ret < 0) {
return;
}

/* Handle the TempURL-related stuff. */
map<int, string> temp_url_keys;
filter_out_temp_url(attrs, rmattr_names, temp_url_keys);
Expand Down