]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: limit op.max and add extra entry to handle tuncation in cls_rgw_reshard_list
authorOrit Wasserman <owasserm@redhat.com>
Fri, 28 Apr 2017 10:13:07 +0000 (13:13 +0300)
committerYehuda Sadeh <yehuda@redhat.com>
Mon, 5 Jun 2017 20:17:37 +0000 (13:17 -0700)
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
src/cls/rgw/cls_rgw.cc

index 03f8764aa914460dc43aeea04b0342b7290c6032..ca002064dd19bb3156fa1b71b1168a5187418339 100644 (file)
@@ -3519,7 +3519,10 @@ static int rgw_reshard_list(cls_method_context_t hctx, bufferlist *in, bufferlis
   bufferlist::iterator iter;
   map<string, bufferlist> vals;
   string filter_prefix;
-  int ret = cls_cxx_map_get_vals(hctx, op.marker, filter_prefix, op.max, &vals);
+  #define MAX_RESHARD_LIST_ENTRIES 1000
+  /* one extra entry for identifying truncation */
+  int32_t max = (op.max < MAX_RESHARD_LIST_ENTRIES ? op.max : MAX_RESHARD_LIST_ENTRIES) + 1;
+  int ret = cls_cxx_map_get_vals(hctx, op.marker, filter_prefix, max, &vals);
   if (ret < 0)
     return ret;
   map<string, bufferlist>::iterator it;