diff options
author | Dave Chinner <dchinner@redhat.com> | 2010-04-14 01:47:55 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-05-19 10:58:13 -0400 |
commit | f983710758218c7aad4aae3e40a7312a21d6f55a (patch) | |
tree | c4647b60e06338c730ebaf0d65ed696cce5e1e68 /fs | |
parent | 36adecff50b69df0369cc2022650c6087aeb255f (diff) |
xfs: make the log ticket transaction id random
The transaction ID that is written to the log for a transaction is
currently set by taking the lower 32 bits of the memory address of
the ticket structure. This is not guaranteed to be unique as
tickets comes from a slab and slots can be reallocated immediately
after being freed. As a result, there is no guarantee of uniqueness
in the ticket ID value.
Fix this by assigning a random number to the ticket ID field so that
it is extremely unlikely that duplicates will occur and remove the
possibility of transactions being mixed up during recovery due to
duplicate IDs.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_log.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 9edbd67b5a9d..77593c2ead4d 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -3417,7 +3417,7 @@ xlog_ticket_alloc( | |||
3417 | tic->t_curr_res = unit_bytes; | 3417 | tic->t_curr_res = unit_bytes; |
3418 | tic->t_cnt = cnt; | 3418 | tic->t_cnt = cnt; |
3419 | tic->t_ocnt = cnt; | 3419 | tic->t_ocnt = cnt; |
3420 | tic->t_tid = (xlog_tid_t)((__psint_t)tic & 0xffffffff); | 3420 | tic->t_tid = random32(); |
3421 | tic->t_clientid = client; | 3421 | tic->t_clientid = client; |
3422 | tic->t_flags = XLOG_TIC_INITED; | 3422 | tic->t_flags = XLOG_TIC_INITED; |
3423 | tic->t_trans_type = 0; | 3423 | tic->t_trans_type = 0; |