Do not crash on PG re-peering events when operations are in progress

This commit is contained in:
Vitaliy Filippov
2021-04-07 11:06:31 +03:00
parent f6d705383a
commit 97efb9e299
11 changed files with 81 additions and 79 deletions
+7 -6
View File
@@ -252,19 +252,20 @@ resume_9:
}
cur_op->reply.hdr.retval = cur_op->req.rw.len;
continue_others:
object_id oid = op_data->oid;
osd_op_t *next_op = NULL;
auto next_it = pg.write_queue.find(op_data->oid);
// Remove the operation from queue before calling finish_op so it doesn't see the completed operation in queue
auto next_it = pg.write_queue.find(oid);
if (next_it != pg.write_queue.end() && next_it->second == cur_op)
{
pg.write_queue.erase(next_it++);
if (next_it != pg.write_queue.end() && next_it->first == op_data->oid)
next_op = next_it->second;
}
// finish_op would invalidate next_it if it cleared pg.write_queue, but it doesn't do that :)
finish_op(cur_op, cur_op->reply.hdr.retval);
// Continue other write operations to the same object
if (next_it != pg.write_queue.end() && next_it->first == oid)
finish_op(cur_op, cur_op->req.rw.len);
if (next_op)
{
osd_op_t *next_op = next_it->second;
// Continue next write to the same object
continue_primary_write(next_op);
}
}