]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: make retry helper policy-free
authorMatan Breizman <mbreizma@redhat.com>
Wed, 3 Jun 2026 09:39:52 +0000 (09:39 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Wed, 3 Jun 2026 09:39:52 +0000 (09:39 +0000)
with_repeat_trans_intr() was previously mixing retry mechanics with
transaction-specific behavior such as reset and preserve handle.

instead, introduce prepare_attempt hook to run before each retry
attempt. Keep the older variant overload with no prepare (internal
users)

Also, fix func/args forwarding to avoid re-moving.

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
src/crimson/os/seastore/transaction_interruptor.h

index c79cce9932b712092e9248b0b56654b0628d1bdd..b2dde2b88b296345584ac7c6d92a8621b524d83c 100644 (file)
@@ -68,25 +68,35 @@ using base_iertr = trans_iertr<base_ertr>;
 template <typename F, typename... Args>
 auto with_trans_intr(Transaction &t, F &&f, Args&&... args) {
   return trans_intr::with_interruption_to_error<crimson::ct_error::eagain>(
-    std::move(f),
+    std::forward<F>(f),
     TransactionConflictCondition(t),
     t,
     std::forward<Args>(args)...);
 }
 
-template <typename F, typename... Args>
-auto with_repeat_trans_intr(Transaction &t, F &&f, Args&&... args) {
-  return repeat_eagain([&t, f=std::move(f), ... args = std::forward<Args>(args) ] {
-    // Try again with a fresh transaction
-    t.reset_preserve_handle();
+template <typename Prepare, typename F, typename... Args>
+auto with_repeat_trans_intr(Prepare &&prepare_attempt, Transaction &t, F &&f, Args&&... args) {
+  return repeat_eagain(
+    [&t,
+    prepare_attempt = std::forward<Prepare>(prepare_attempt),
+    f = std::forward<F>(f),
+    ... args = std::forward<Args>(args) ] {
+    prepare_attempt();
     return trans_intr::with_interruption_to_error<crimson::ct_error::eagain>(
-      std::move(f),
+      f,
       TransactionConflictCondition(t),
       t,
-      std::forward<Args>(args)...);
+      args...);
   });
+}
 
-
+template <typename F, typename... Args>
+auto with_repeat_trans_intr(Transaction &t, F &&f, Args&&... args) {
+  return with_repeat_trans_intr(
+      [] {},
+      t,
+      std::forward<F>(f),
+      std::forward<Args>(args)...);
 }
 
 template <typename T>