forked from vitalif/vitastor
Fix possible crash on ENOSPC during operation cancel in blockstore
parent
a4dfa519af
commit
71d6d9f868
|
@ -193,6 +193,7 @@ void blockstore_impl_t::loop()
|
||||||
}
|
}
|
||||||
if (wr_st == 2)
|
if (wr_st == 2)
|
||||||
{
|
{
|
||||||
|
submit_queue[op_idx] = NULL;
|
||||||
new_idx--;
|
new_idx--;
|
||||||
}
|
}
|
||||||
if (wr_st == 0)
|
if (wr_st == 0)
|
||||||
|
|
|
@ -181,10 +181,16 @@ void blockstore_impl_t::cancel_all_writes(blockstore_op_t *op, blockstore_dirty_
|
||||||
}
|
}
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (auto other_op: submit_queue)
|
for (auto other_op: submit_queue)
|
||||||
|
{
|
||||||
|
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
|
// <op> may be present in queue multiple times due to moving operations in submit_queue
|
||||||
if (other_op == op)
|
|
||||||
found = true;
|
found = true;
|
||||||
|
}
|
||||||
else if (found && other_op->oid == op->oid &&
|
else if (found && other_op->oid == op->oid &&
|
||||||
(other_op->opcode == BS_OP_WRITE || other_op->opcode == BS_OP_WRITE_STABLE))
|
(other_op->opcode == BS_OP_WRITE || other_op->opcode == BS_OP_WRITE_STABLE))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue