Contexts executed by _finish_flush() may call _issue_read(),
_issue_read() may add new context to tail of waitfor_safe list.
So _finish_flush() should first remove contexts from waitfor_safe,
then execute the contexts.
Fixes: http://tracker.ceph.com/issues/20338
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
<< dendl;
// kick waiters <= safe_pos
- while (!waitfor_safe.empty()) {
- if (waitfor_safe.begin()->first > safe_pos)
- break;
- finish_contexts(cct, waitfor_safe.begin()->second);
- waitfor_safe.erase(waitfor_safe.begin());
+ if (!waitfor_safe.empty()) {
+ list<Context*> ls;
+ while (!waitfor_safe.empty()) {
+ auto it = waitfor_safe.begin();
+ if (it->first > safe_pos)
+ break;
+ ls.splice(ls.end(), it->second);
+ waitfor_safe.erase(it);
+ }
+ finish_contexts(cct, ls);
}
}