From: Matan Breizman Date: Wed, 3 Jun 2026 09:39:52 +0000 (+0000) Subject: crimson/os/seastore: make retry helper policy-free X-Git-Tag: v21.0.1~19^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b4194fe967b413386b256e2bad2c331a19ba57b1;p=ceph.git crimson/os/seastore: make retry helper policy-free 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 --- diff --git a/src/crimson/os/seastore/transaction_interruptor.h b/src/crimson/os/seastore/transaction_interruptor.h index c79cce9932b..b2dde2b88b2 100644 --- a/src/crimson/os/seastore/transaction_interruptor.h +++ b/src/crimson/os/seastore/transaction_interruptor.h @@ -68,25 +68,35 @@ using base_iertr = trans_iertr; template auto with_trans_intr(Transaction &t, F &&f, Args&&... args) { return trans_intr::with_interruption_to_error( - std::move(f), + std::forward(f), TransactionConflictCondition(t), t, 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(); +template +auto with_repeat_trans_intr(Prepare &&prepare_attempt, Transaction &t, F &&f, Args&&... args) { + return repeat_eagain( + [&t, + prepare_attempt = std::forward(prepare_attempt), + f = std::forward(f), + ... args = std::forward(args) ] { + prepare_attempt(); return trans_intr::with_interruption_to_error( - std::move(f), + f, TransactionConflictCondition(t), t, - std::forward(args)...); + args...); }); +} - +template +auto with_repeat_trans_intr(Transaction &t, F &&f, Args&&... args) { + return with_repeat_trans_intr( + [] {}, + t, + std::forward(f), + std::forward(args)...); } template