From 22ad727fed7f640f591c5e17c81978d7ec171d3e Mon Sep 17 00:00:00 2001 From: Matan Breizman Date: Mon, 4 Aug 2025 10:54:34 +0000 Subject: [PATCH] crimson/os/seastore: introduce with_repeat_trans_intr 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 --- src/crimson/os/seastore/transaction_interruptor.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/crimson/os/seastore/transaction_interruptor.h b/src/crimson/os/seastore/transaction_interruptor.h index 794564fdc81fc..9057ad419b267 100644 --- a/src/crimson/os/seastore/transaction_interruptor.h +++ b/src/crimson/os/seastore/transaction_interruptor.h @@ -73,6 +73,21 @@ auto with_trans_intr(Transaction &t, F &&f, Args&&... args) { std::forward(args)...); } +template +auto with_repeat_trans_intr(Transaction &t, F &&f, Args&&... args) { + return repeat_eagain([&t, f=std::move(f), ... args = std::forward(args) ] { + // Try again with a fresh transaction + t.reset_preserve_handle(); + return trans_intr::with_interruption_to_error( + std::move(f), + TransactionConflictCondition(t), + t, + std::forward(args)...); + }); + + +} + template using with_trans_ertr = typename T::base_ertr::template extend; -- 2.39.5