Fix possible crash on ENOSPC during operation cancel in blockstore

rm-left-on-dead
Vitaliy Filippov 2023-01-02 11:01:19 +03:00
parent a4dfa519af
commit 71d6d9f868
2 changed files with 9 additions and 2 deletions

View File

@ -193,6 +193,7 @@ void blockstore_impl_t::loop()
}
if (wr_st == 2)
{
submit_queue[op_idx] = NULL;
new_idx--;
}
if (wr_st == 0)

View File

@ -182,9 +182,15 @@ void blockstore_impl_t::cancel_all_writes(blockstore_op_t *op, blockstore_dirty_
bool found = false;
for (auto other_op: submit_queue)
{
// <op> may be present in queue multiple times due to moving operations in submit_queue
if (other_op == op)
if (!other_op)
{
// freed operations during submitting are zeroed
}
else if (other_op == op)
{
// <op> may be present in queue multiple times due to moving operations in submit_queue
found = true;
}
else if (found && other_op->oid == op->oid &&
(other_op->opcode == BS_OP_WRITE || other_op->opcode == BS_OP_WRITE_STABLE))
{