]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/transaction_manager: refresh the indirect_cursor
authorXuehan Xu <xuxuehan@qianxin.com>
Thu, 18 Jun 2026 05:18:47 +0000 (13:18 +0800)
committerXuehan Xu <xuxuehan@qianxin.com>
Mon, 22 Jun 2026 12:53:24 +0000 (20:53 +0800)
after removing the direct_cursor in _remove()

Fixes: https://tracker.ceph.com/issues/77485
Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
src/crimson/os/seastore/transaction_manager.cc

index f0e586220b9ef4f6f4607a843529e2f01b6893e1..9a66a80d3b8fe6139e6b7e5cf334339ead1e3775 100644 (file)
@@ -331,6 +331,12 @@ TransactionManager::_remove(
     indirect_cursor = co_await lba_manager->update_mapping_refcount(
       t, mapping.indirect_cursor, -1);
     co_await mapping.direct_cursor->refresh();
+    if (unlikely(indirect_cursor->get_key() ==
+          mapping.direct_cursor->get_key())) {
+      // indirect_cursor points to the same mapping as direct_cursor,
+      // no need to keep it
+      indirect_cursor.reset();
+    }
   }
 
   DEBUGT("removing direct mapping {}~0x{:x} refcount={} -- offset={}",
@@ -345,6 +351,10 @@ TransactionManager::_remove(
   LBACursorRef direct_cursor = co_await lba_manager->update_mapping_refcount(
     t, mapping.direct_cursor, -1);
 
+  if (indirect_cursor) {
+    co_await indirect_cursor->refresh();
+  }
+
   auto ret = co_await resolve_cursor_to_mapping(
     t,
     indirect_cursor ? std::move(indirect_cursor) : std::move(direct_cursor)