From: Orit Wasserman Date: Sun, 22 Apr 2018 08:22:01 +0000 (+0300) Subject: rgw: fix bi_list to reset is_truncated flag if it skips entires X-Git-Tag: v12.2.6~125^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e21cb779e6e0debab396cec0710695456b18dce7;p=ceph.git rgw: fix bi_list to reset is_truncated flag if it skips entires Fixes: http://tracker.ceph.com/issues/22721 Signed-off-by: Orit Wasserman (cherry picked from commit 670e2c557ea54276bf38e56fcc36ac2f38ce317c) --- diff --git a/src/cls/rgw/cls_rgw.cc b/src/cls/rgw/cls_rgw.cc index dc9da596854..d7deb78f8b6 100644 --- a/src/cls/rgw/cls_rgw.cc +++ b/src/cls/rgw/cls_rgw.cc @@ -2296,6 +2296,9 @@ static int list_plain_entries(cls_method_context_t hctx, const string& name, con for (iter = keys.begin(); iter != keys.end(); ++iter) { if (iter->first >= end_key) { /* past the end of plain namespace */ + if (pmore) { + *pmore = false; + } return count; } @@ -2317,6 +2320,10 @@ static int list_plain_entries(cls_method_context_t hctx, const string& name, con CLS_LOG(20, "%s(): entry.idx=%s e.key.name=%s", __func__, escape_str(entry.idx).c_str(), escape_str(e.key.name).c_str()); if (!name.empty() && e.key.name != name) { + /* we are skipping the rest of the entries */ + if (pmore) { + *pmore = false; + } return count; } @@ -2379,6 +2386,10 @@ static int list_instance_entries(cls_method_context_t hctx, const string& name, entry.data = iter->second; if (!filter.empty() && entry.idx.compare(0, filter.size(), filter) != 0) { + /* we are skipping the rest of the entries */ + if (pmore) { + *pmore = false; + } return count; } @@ -2395,6 +2406,10 @@ static int list_instance_entries(cls_method_context_t hctx, const string& name, } if (!name.empty() && e.key.name != name) { + /* we are skipping the rest of the entries */ + if (pmore) { + *pmore = false; + } return count; } @@ -2456,6 +2471,10 @@ static int list_olh_entries(cls_method_context_t hctx, const string& name, const entry.data = iter->second; if (!filter.empty() && entry.idx.compare(0, filter.size(), filter) != 0) { + /* we are skipping the rest of the entries */ + if (pmore) { + *pmore = false; + } return count; } @@ -2472,6 +2491,10 @@ static int list_olh_entries(cls_method_context_t hctx, const string& name, const } if (!name.empty() && e.key.name != name) { + /* we are skipping the rest of the entries */ + if (pmore) { + *pmore = false; + } return count; } @@ -2502,7 +2525,7 @@ static int rgw_bi_list_op(cls_method_context_t hctx, bufferlist *in, bufferlist int32_t max = (op.max < MAX_BI_LIST_ENTRIES ? op.max : MAX_BI_LIST_ENTRIES); string start_key = op.marker; bool more; - int ret = list_plain_entries(hctx, op.name, op.marker, max, &op_ret.entries, &more); + int ret = list_plain_entries(hctx, op.name, op.marker, max, &op_ret.entries, &more); if (ret < 0) { CLS_LOG(0, "ERROR: %s(): list_plain_entries retured ret=%d", __func__, ret); return ret;