From b4d7897fc6e192cdd89aab57cb0119f9174a3c54 Mon Sep 17 00:00:00 2001 From: Xuehan Xu Date: Mon, 22 Aug 2022 14:51:12 +0800 Subject: [PATCH] crimson/os/seastore/async_cleaner: fill the semantic gap between backref get_mappings and space reclaim Signed-off-by: Xuehan Xu --- src/crimson/os/seastore/async_cleaner.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/crimson/os/seastore/async_cleaner.cc b/src/crimson/os/seastore/async_cleaner.cc index e92f2d2092f..3d25f054e3b 100644 --- a/src/crimson/os/seastore/async_cleaner.cc +++ b/src/crimson/os/seastore/async_cleaner.cc @@ -985,6 +985,16 @@ AsyncCleaner::gc_reclaim_space_ret AsyncCleaner::gc_reclaim_space() reclaim_state->start_pos, reclaim_state->end_pos ).si_then([this, &t](auto pin_list) { + if (!pin_list.empty()) { + auto it = pin_list.begin(); + auto &first_pin = *it; + if (first_pin->get_key() < reclaim_state->start_pos) { + // BackrefManager::get_mappings may include a entry before + // reclaim_state->start_pos, which is semantically inconsistent + // with the requirements of the cleaner + pin_list.erase(it); + } + } return backref_manager.retrieve_backref_extents_in_range( t, reclaim_state->start_pos, -- 2.39.5