crimson/os/seastore/transaction_manager: allow non-existing lba regions

when demoting them

It is possible that, when we do demote_region, the target region has
already been removed from the lba tree, for example, a temp recovering
object might have already been renamed to the real one, which means all
lba mappings within its original region have been moved away.

Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
This commit is contained in:
Xuehan Xu 2026-07-20 10:18:12 +08:00
parent e89e2104a8
commit 6b6c8d4da3

View File

@ -1579,10 +1579,21 @@ TransactionManager::demote_region(
auto cursor = co_await lba_manager->upper_bound_right(
t, start
).handle_error_interruptible(
crimson::ct_error::enoent::handle([](auto) {
// It's possible that there has been no lba mappings left
// when demoting a region, for example, a temp recovering
// object may have been renamed, which makes the lba mappings
// in its own region moved.
return seastar::make_ready_future<LBACursorRef>();
}),
demote_region_iertr::pass_further{},
crimson::ct_error::assert_all("unexpected enoent"));
auto it = co_await resolve_cursor_to_mapping(t, std::move(cursor));
demote_region_res_t ret{0, 0, false};
if (!cursor) {
ret.complete = true;
co_return ret;
}
auto it = co_await resolve_cursor_to_mapping(t, std::move(cursor));
std::vector<CachedExtentRef> extents;
while ((ret.demoted_size + ret.evicted_size) < max_proceed_size) {
if (it.is_end() || it.get_key().get_object_prefix() != prefix) {