]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/os/seastore: introduce with_repeat_trans_intr
authorMatan Breizman <mbreizma@redhat.com>
Mon, 4 Aug 2025 10:54:34 +0000 (10:54 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Sun, 10 Aug 2025 11:42:03 +0000 (11:42 +0000)
Most of with_trans_intr use repeat_eagain so it makes sense to introduce
this wrapper and audit exisitng users (future PR).

Note: each repeated iteration should use a fresh txn if we failed
in-flight.

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

index 794564fdc81fc98bbd4fc7f7fd340842f90a92e0..9057ad419b267b0ea9eec483aab21d9a3415c942 100644 (file)
@@ -73,6 +73,21 @@ auto with_trans_intr(Transaction &t, F &&f, Args&&... args) {
     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();
+    return trans_intr::with_interruption_to_error<crimson::ct_error::eagain>(
+      std::move(f),
+      TransactionConflictCondition(t),
+      t,
+      std::forward<Args>(args)...);
+  });
+
+
+}
+
 template <typename T>
 using with_trans_ertr = typename T::base_ertr::template extend<crimson::ct_error::eagain>;