From: Sage Weil Date: Mon, 18 Feb 2013 04:49:52 +0000 (-0800) Subject: osd: pull requeued requests off one at a time X-Git-Tag: v0.58~29^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f1841e4189fce70ef5722d508289e516faa9af6a;p=ceph.git 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 Reviewed-by: Samuel Just --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index a1546bc606d9..d5f2b2299a43 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -3545,22 +3545,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 waiting; - waiting.splice(waiting.begin(), finished); - - finished_lock.Unlock(); - - dout(10) << "do_waiters -- start" << dendl; - for (list::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)