]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix osd crashes when execute "radosgw-admin bi list --max-entries=1" command 12227/head
authorweiqiaomiao <wei.qiaomiao@zte.com.cn>
Mon, 31 Oct 2016 05:59:55 +0000 (13:59 +0800)
committerOrit Wasserman <owasserm@redhat.com>
Mon, 2 Jan 2017 10:13:26 +0000 (12:13 +0200)
Fixes: http://tracker.ceph.com/issues/17745
Signed-off-by: weiqiaomiao <wei.qiaomiao@zte.com.cn>
(cherry picked from commit 51a4405a1ef59671cbd51c530a84333359d3f3dd)

src/cls/rgw/cls_rgw.cc

index b4d09da587e44bae0aec7a301045d1784f7db8df..9e9f45fdb40da1624efb506a04d0ee69e6463bb8 100644 (file)
@@ -2375,9 +2375,9 @@ static int rgw_bi_list_op(cls_method_context_t hctx, bufferlist *in, bufferlist
 
   string filter = op.name;
 #define MAX_BI_LIST_ENTRIES 1000
-  int32_t max = (op.max < MAX_BI_LIST_ENTRIES ? op.max : MAX_BI_LIST_ENTRIES);
+  int32_t max = (op.max < MAX_BI_LIST_ENTRIES ? op.max : MAX_BI_LIST_ENTRIES) + 1; /* one extra entry for identifying truncation */
   string start_key = op.marker;
-  int ret = list_plain_entries(hctx, op.name, op.marker, max, &op_ret.entries) + 1; /* one extra entry for identifying truncation */
+  int ret = list_plain_entries(hctx, op.name, op.marker, max, &op_ret.entries)
   if (ret < 0) {
     CLS_LOG(0, "ERROR: %s(): list_plain_entries retured ret=%d", __func__, ret);
     return ret;