Skip to content

Commit

Permalink
rgw: don't try to wait for pending if list is empty
Browse files Browse the repository at this point in the history
Fixes: ceph#8846
Backport: firefly, dumpling

This was broken at ea68b93. We ended
up calling wait_pending_front() when pending list was empty.
This commit also moves the need_to_wait check to a different place,
where we actually throttle (and not just drain completed IOs).

Reported-by: Sylvain Munaut <[email protected]>
Signed-off-by: Yehuda Sadeh <[email protected]>
  • Loading branch information
yehudasa committed Jul 16, 2014
1 parent 8347723 commit f9f2417
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/rgw/rgw_rados.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,9 @@ struct put_obj_aio_info RGWPutObjProcessor_Aio::pop_pending()

int RGWPutObjProcessor_Aio::wait_pending_front()
{
if (pending.empty()) {
return 0;
}
struct put_obj_aio_info info = pop_pending();
int ret = store->aio_wait(info.handle);
return ret;
Expand Down Expand Up @@ -1131,8 +1134,9 @@ int RGWPutObjProcessor_Aio::throttle_data(void *handle, bool need_to_wait)
pending.push_back(info);
}
size_t orig_size = pending.size();
while (pending_has_completed()
|| need_to_wait) {

/* first drain complete IOs */
while (pending_has_completed()) {
int r = wait_pending_front();
if (r < 0)
return r;
Expand All @@ -1145,10 +1149,14 @@ int RGWPutObjProcessor_Aio::throttle_data(void *handle, bool need_to_wait)
max_chunks++;
}

if (pending.size() > max_chunks) {
/* now throttle. Note that need_to_wait should only affect the first IO operation */
if (pending.size() > max_chunks ||
need_to_wait) {
int r = wait_pending_front();
if (r < 0)
return r;

need_to_wait = false;
}
return 0;
}
Expand Down

0 comments on commit f9f2417

Please sign in to comment.