On 2024/7/12 17:53, Luis Henriques wrote:still need add 1. Sorry for confuse.
Since there's code (in fast-commit) that already handles a '0' tid as aDo we need add j_transaction_sequence again here? if tansanction->t_tid == 0, then journal->j_trnasaction_sequence must be 1
special case, it's better to ensure that jbd2 never sets it to that value
when journal->j_transaction_sequence increment wraps.
Suggested-by: Andreas Dilger <adilger@xxxxxxxxx>
Signed-off-by: Luis Henriques (SUSE) <luis.henriques@xxxxxxxxx>
---
fs/jbd2/transaction.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 66513c18ca29..4dbdd37349c3 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -84,6 +84,8 @@ static void jbd2_get_transaction(journal_t *journal,
transaction->t_state = T_RUNNING;
transaction->t_start_time = ktime_get();
transaction->t_tid = journal->j_transaction_sequence++;
+ if (unlikely(transaction->t_tid == 0))
+ transaction->t_tid = journal->j_transaction_sequence++;
--
transaction->t_expires = jiffies + journal->j_commit_interval;
atomic_set(&transaction->t_updates, 0);
atomic_set(&transaction->t_outstanding_credits,