提交 524ee36f 编写于 作者: D Dave Chinner 提交者: Alex Elder

xfs: Don't reuse the same transaction ID for duplicated transactions.

The transaction ID is written into the log as the unique identifier
for transactions during recover. When duplicating a transaction, we
reuse the log ticket, which means it has the same transaction ID as
the previous transaction.

Rather than regenerating a random transaction ID for the duplicated
transaction, just add one to the current ID so that duplicated
transaction can be easily spotted in the log and during recovery
during problem diagnosis.
Signed-off-by: NDave Chinner <dchinner@redhat.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NAlex Elder <aelder@sgi.com>
上级 b4ed4626
...@@ -360,6 +360,15 @@ xfs_log_reserve( ...@@ -360,6 +360,15 @@ xfs_log_reserve(
ASSERT(flags & XFS_LOG_PERM_RESERV); ASSERT(flags & XFS_LOG_PERM_RESERV);
internal_ticket = *ticket; internal_ticket = *ticket;
/*
* this is a new transaction on the ticket, so we need to
* change the transaction ID so that the next transaction has a
* different TID in the log. Just add one to the existing tid
* so that we can see chains of rolling transactions in the log
* easily.
*/
internal_ticket->t_tid++;
trace_xfs_log_reserve(log, internal_ticket); trace_xfs_log_reserve(log, internal_ticket);
xlog_grant_push_ail(mp, internal_ticket->t_unit_res); xlog_grant_push_ail(mp, internal_ticket->t_unit_res);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册