diff options
author | Dave Chinner <dchinner@redhat.com> | 2013-08-28 21:22:46 +1000 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-08-30 13:43:34 -0500 |
commit | b58fa554e9b940083a0691f7234c13240fc09377 (patch) | |
tree | 149471a75a6e5b71af135e7154a7ea2d037d60db /fs | |
parent | 37804376121de1a25fb582bdd8970f139c4d9685 (diff) | |
download | op-kernel-dev-b58fa554e9b940083a0691f7234c13240fc09377.zip op-kernel-dev-b58fa554e9b940083a0691f7234c13240fc09377.tar.gz |
xfs: btree block LSN escaping to disk uninitialised
When testing LSN ordering code for v5 superblocks, it was discovered
that the the LSN embedded in the generic btree blocks was
occasionally uninitialised. These values didn't get written to disk
by metadata writeback - they got written by previous transactions in
log recovery.
The issue is here that the when the block is first allocated and
initialised, the LSN field was not initialised - it gets overwritten
before IO is issued on the buffer - but the value that is logged by
transactions that modify the header before it is written to disk
(and initialised) contain garbage. Hence the first recovery of the
buffer will stamp garbage into the LSN field, and that can cause
subsequent transactions to not replay correctly.
The fix is simply to initialise the bb_lsn field to zero when we
initialise the block for the first time.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_btree.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c index ae106f6..7a2b4da 100644 --- a/fs/xfs/xfs_btree.c +++ b/fs/xfs/xfs_btree.c @@ -978,6 +978,7 @@ xfs_btree_init_block_int( buf->bb_u.l.bb_owner = cpu_to_be64(owner); uuid_copy(&buf->bb_u.l.bb_uuid, &mp->m_sb.sb_uuid); buf->bb_u.l.bb_pad = 0; + buf->bb_u.l.bb_lsn = 0; } } else { /* owner is a 32 bit value on short blocks */ @@ -989,6 +990,7 @@ xfs_btree_init_block_int( buf->bb_u.s.bb_blkno = cpu_to_be64(blkno); buf->bb_u.s.bb_owner = cpu_to_be32(__owner); uuid_copy(&buf->bb_u.s.bb_uuid, &mp->m_sb.sb_uuid); + buf->bb_u.s.bb_lsn = 0; } } } |