From d1602b50b38442a0d10df2ae723f32b89b1cb9f1 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sat, 23 May 2020 22:34:40 +0300 Subject: [PATCH] Fix BS_OP_ROLLBACK removing an incorrect version Instead of only removing versions with oid == X and version > Y it was also removing the previous version in list (with the previous oid or with version == Y) --- blockstore_rollback.cpp | 10 +++++----- osd_primary_subops.cpp | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/blockstore_rollback.cpp b/blockstore_rollback.cpp index 36f8e7f4..1b502b10 100644 --- a/blockstore_rollback.cpp +++ b/blockstore_rollback.cpp @@ -171,16 +171,16 @@ resume_5: rm_start--; while (1) { - if (rm_start->first.oid != v->oid) - break; - else if (rm_start->first.version <= v->version) + if (rm_start->first.oid != v->oid || rm_start->first.version <= v->version) + { + rm_start++; break; + } if (rm_start == dirty_db.begin()) break; rm_start--; } - if (rm_end != rm_start) - erase_dirty(rm_start, rm_end, UINT64_MAX); + erase_dirty(rm_start, rm_end, UINT64_MAX); } journal.trim(); inflight_writes--; diff --git a/osd_primary_subops.cpp b/osd_primary_subops.cpp index a3cdcd0f..2e0adf82 100644 --- a/osd_primary_subops.cpp +++ b/osd_primary_subops.cpp @@ -247,7 +247,6 @@ void osd_t::handle_primary_subop(uint64_t opcode, osd_op_t *cur_op, int retval, { if (op_data->fact_ver != 0 && op_data->fact_ver != version) { - // FIXME There is still a bug that leads to this exception sometimes :-(( throw std::runtime_error( "different fact_versions returned from "+std::string(osd_op_names[opcode])+ " subops: "+std::to_string(version)+" vs "+std::to_string(op_data->fact_ver)