From b4edc79449f03e0725f50fa93100f7a3f66e9587 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sat, 12 Nov 2022 11:59:43 +0300 Subject: [PATCH] Fix possible segfault on ENOSPC --- src/blockstore_write.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/blockstore_write.cpp b/src/blockstore_write.cpp index d1c56e65..5ccba102 100644 --- a/src/blockstore_write.cpp +++ b/src/blockstore_write.cpp @@ -182,7 +182,8 @@ void blockstore_impl_t::cancel_all_writes(blockstore_op_t *op, blockstore_dirty_ bool found = false; for (auto other_op: submit_queue) { - if (!found && other_op == op) + // may be present in queue multiple times due to moving operations in submit_queue + if (other_op == op) found = true; else if (found && other_op->oid == op->oid && (other_op->opcode == BS_OP_WRITE || other_op->opcode == BS_OP_WRITE_STABLE))