summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-02-17 20:49:52 -0800
committerSage Weil <sage@inktank.com>2013-02-25 15:29:31 -0800
commit79c4e7e91becc497843d96251776bdc176706aa0 (patch)
treec0cf0b13612160e69baba6c3c361f3eaf1d8e38a
parent3a6ce5d0355beaa56199465e94666cae40bd8da1 (diff)
downloadceph-79c4e7e91becc497843d96251776bdc176706aa0.tar.gz
osd: pull requeued requests off one at a time
Pull items off the finished queue on at a time. In certain cases, an event may result in new items betting added to the finished queue that will be put at the *front* instead of the back. See latest incarnation of #2947. Note that this is a significant changed in behavior in that we can theoretically starve if an event keeps resulting in new events getting generated. Beware! Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Samuel Just <sam.just@inktank.com> (cherry picked from commit f1841e4189fce70ef5722d508289e516faa9af6a)
-rw-r--r--src/osd/OSD.cc21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc
index 779849c48ea..e5005009250 100644
--- a/src/osd/OSD.cc
+++ b/src/osd/OSD.cc
@@ -3356,22 +3356,17 @@ void OSD::do_waiters()
{
assert(osd_lock.is_locked());
+ dout(10) << "do_waiters -- start" << dendl;
finished_lock.Lock();
- if (finished.empty()) {
+ while (!finished.empty()) {
+ OpRequestRef next = finished.front();
+ finished.pop_front();
finished_lock.Unlock();
- } else {
- list<OpRequestRef> waiting;
- waiting.splice(waiting.begin(), finished);
-
- finished_lock.Unlock();
-
- dout(10) << "do_waiters -- start" << dendl;
- for (list<OpRequestRef>::iterator it = waiting.begin();
- it != waiting.end();
- it++)
- dispatch_op(*it);
- dout(10) << "do_waiters -- finish" << dendl;
+ dispatch_op(next);
+ finished_lock.Lock();
}
+ finished_lock.Unlock();
+ dout(10) << "do_waiters -- finish" << dendl;
}
void OSD::dispatch_op(OpRequestRef op)