Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgw: Fix infinite call for bi list when resharding a bucket #21584

Merged
merged 1 commit into from Apr 26, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 24 additions & 1 deletion src/cls/rgw/cls_rgw.cc
Expand Up @@ -2292,6 +2292,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;
}

Expand All @@ -2313,6 +2316,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;
}

Expand Down Expand Up @@ -2375,6 +2382,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;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oritwas missing another case in each of list_instance_entries() and list_olh_entries()

Expand All @@ -2391,6 +2402,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;
}

Expand Down Expand Up @@ -2452,6 +2467,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;
}

Expand All @@ -2468,6 +2487,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;
}

Expand Down Expand Up @@ -2498,7 +2521,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 returned ret=%d", __func__, ret);
return ret;
Expand Down