The ls argument passed to requeue_ops() is a reference, and one of the
methods we call (say, _handle_op) might want to requeue the message on the
same list we were passed, leading to an infinite loop.
Set ls contents aside to avoid that.
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
list<Message*> orig_queue;
orig_queue.swap(pg->op_queue);
+ // grab whole list at once, in case methods we call below start adding things
+ // back on the list reference we were passed!
+ list<Message*> q;
+ q.swap(ls);
+
// requeue old items, now at front.
- while (!ls.empty()) {
- Message *op = ls.front();
- ls.pop_front();
+ while (!q.empty()) {
+ Message *op = q.front();
+ q.pop_front();
switch (op->get_type()) {
case CEPH_MSG_OSD_OP: