From a5d1fa0587184f43c69d8e03114b58d43f320781 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 26 Jan 2017 16:26:42 -0800 Subject: [PATCH] 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 --- src/rgw/rgw_rados.cc | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 46ed77dd9df..9ccadb2b249 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -5122,21 +5122,20 @@ int RGWRados::Bucket::List::list_objects(int max, vector *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 *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))