rgw: avoid empty object names

Don't try to sync an object with empty name (shouldn't happen, but
bugs may happen). Also, don't try to write_meta() of an empty object
name, in case we get there through a different path somehow.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
This commit is contained in:
Yehuda Sadeh 2016-02-18 23:50:06 -08:00
parent 3f525f4043
commit 9695a0b4d1
2 changed files with 12 additions and 0 deletions

View File

@ -1834,6 +1834,12 @@ public:
do {
yield {
marker_tracker->reset_need_retry(key);
if (key.name.empty()) {
/* shouldn't happen */
set_status("skipping empty entry");
ldout(sync_env->cct, 0) << "ERROR: " << __func__ << "(): entry with empty obj name, skipping" << dendl;
goto done;
}
if (op == CLS_RGW_OP_ADD ||
op == CLS_RGW_OP_LINK_OLH) {
if (op == CLS_RGW_OP_ADD && !key.instance.empty() && key.instance != "null") {

View File

@ -5659,6 +5659,12 @@ int RGWRados::Object::Write::write_meta(uint64_t size,
return r;
rgw_obj& obj = target->get_obj();
if (obj.get_object().empty()) {
ldout(store->ctx(), 0) << "ERROR: " << __func__ << "(): cannot write object with empty name" << dendl;
return -EIO;
}
r = store->get_obj_ref(obj, &ref, &bucket);
if (r < 0)
return r;