rgw: fix use of marker in List::list_objects()

Fixes: http://tracker.ceph.com/issues/18331

List marker is an index key, so treat it as such. This
fixes infinite loop in orphans find command.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
This commit is contained in:
Yehuda Sadeh 2017-01-26 16:26:42 -08:00
parent fc9a03ec4f
commit a5d1fa0587

View File

@ -5122,21 +5122,20 @@ int RGWRados::Bucket::List::list_objects(int max, vector<RGWObjEnt> *result,
result->clear();
rgw_obj marker_obj, end_marker_obj, prefix_obj;
marker_obj.set_instance(params.marker.instance);
marker_obj.set_ns(params.ns);
marker_obj.set_obj(params.marker.name);
rgw_bucket b;
rgw_obj marker_obj(b, params.marker);
rgw_obj end_marker_obj(b, params.end_marker);
rgw_obj prefix_obj;
rgw_obj_key cur_end_marker;
if (!params.ns.empty()) {
marker_obj.set_ns(params.ns);
end_marker_obj.set_ns(params.ns);
end_marker_obj.get_index_key(&cur_end_marker);
}
rgw_obj_key cur_marker;
marker_obj.get_index_key(&cur_marker);
end_marker_obj.set_instance(params.end_marker.instance);
end_marker_obj.set_ns(params.ns);
end_marker_obj.set_obj(params.end_marker.name);
rgw_obj_key cur_end_marker;
if (params.ns.empty()) { /* no support for end marker for namespaced objects */
end_marker_obj.get_index_key(&cur_end_marker);
}
const bool cur_end_marker_valid = !cur_end_marker.empty();
const bool cur_end_marker_valid = !params.end_marker.empty();
prefix_obj.set_ns(params.ns);
prefix_obj.set_obj(params.prefix);
@ -5212,8 +5211,8 @@ int RGWRados::Bucket::List::list_objects(int max, vector<RGWObjEnt> *result,
}
if (count < max) {
params.marker = obj;
next_marker = obj;
params.marker = key;
next_marker = key;
}
if (params.filter && !params.filter->filter(obj.name, key.name))