The cancel_copy() method removes the entry from copy_ops. Move the
iterator forward before calling.
Fixes segfault when thrashing osds with a copy-from workload.
Signed-off-by: Sage Weil <sage@inktank.com>
void ReplicatedPG::cancel_copy_ops()
{
dout(10) << __func__ << dendl;
- for (map<hobject_t,CopyOpRef>::iterator p = copy_ops.begin();
- p != copy_ops.end();
- copy_ops.erase(p++)) {
- cancel_copy(p->second);
+ map<hobject_t,CopyOpRef>::iterator p = copy_ops.begin();
+ while (p != copy_ops.end()) {
+ cancel_copy((p++)->second);
}
}