]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix use of marker in List::list_objects() 14517/head
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 27 Jan 2017 00:26:42 +0000 (16:26 -0800)
committerNathan Cutler <ncutler@suse.com>
Mon, 3 Jul 2017 13:19:19 +0000 (15:19 +0200)
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>
(cherry picked from commit a5d1fa0587184f43c69d8e03114b58d43f320781)

src/rgw/rgw_rados.cc

index 47f3790b3313f8bec57941863b15ab60059f5621..d7cea0d02c4495f11a5511b805844252b7cbbba4 100644 (file)
@@ -5103,21 +5103,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_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_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()) { /* no support for end marker for namespaced objects */
+  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);
   }
-  const bool cur_end_marker_valid = !cur_end_marker.empty();
+  rgw_obj_key cur_marker;
+  marker_obj.get_index_key(&cur_marker);
+
+  const bool cur_end_marker_valid = !params.end_marker.empty();
 
   prefix_obj.set_ns(params.ns);
   prefix_obj.set_obj(params.prefix);
@@ -5193,8 +5192,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))