linux/fs/xfs
Andy Poling fc5bc4c85c xfs: Wrapped journal record corruption on read at recovery
Summary of problem:

If a journal record wraps at the physical end of the journal, it has to be
read in two parts in xlog_do_recovery_pass(): a read at the physical end and a
read at the physical beginning.  If xlog_bread() has to re-align the first
read, the second read request does not take that re-alignment into account.
If the first read was re-aligned, the second read over-writes the end of the
data from the first read, effectively corrupting it.  This can happen either
when reading the record header or reading the record data.

The first sanity check in xlog_recover_process_data() is to check for a valid
clientid, so that is the error reported.

Summary of fix:

If there was a first read at the physical end, XFS_BUF_PTR() returns where the
data was requested to begin.  Conversely, because it is the result of
xlog_align(), offset indicates where the requested data for the first read
actually begins - whether or not xlog_bread() has re-aligned it.

Using offset as the base for the calculation of where to place the second read
data ensures that it will be correctly placed immediately following the data
from the first read instead of sometimes over-writing the end of it.

The attached patch has resolved the reported problem of occasional inability
to recover the journal (reporting "bad clientid").

Signed-off-by: Andy Poling <andy@realbig.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
2009-12-11 15:11:21 -06:00
..
linux-2.6 xfs: cleanup data end I/O handlers 2009-12-11 15:11:20 -06:00
quota xfs: fix double IRELE in xfs_dqrele_inode 2009-10-13 13:16:36 -05:00
support xfs: cleanup uuid handling 2009-03-30 10:21:31 +02:00
Kconfig xfs: use generic Posix ACL code 2009-06-10 17:07:47 +02:00
Makefile xfs: use generic Posix ACL code 2009-06-10 17:07:47 +02:00
xfs.h [XFS] make btree tracing generic 2008-10-30 16:55:13 +11:00
xfs_acl.h switch xfs to generic acl caching helpers 2009-06-24 08:17:07 -04:00
xfs_ag.h xfs: speed up free inode search 2009-09-01 12:45:48 -05:00
xfs_alloc.c un-static xfs_read_agf 2009-08-31 14:46:21 -05:00
xfs_alloc.h xfs: factor out code to find the longest free extent in the AG 2009-03-16 08:29:46 +01:00
xfs_alloc_btree.c [XFS] Remove the rest of the macro-to-function indirections. 2009-01-19 14:45:55 +11:00
xfs_alloc_btree.h [XFS] Always use struct xfs_btree_block instead of short / longform 2008-10-30 17:14:34 +11:00
xfs_arch.h xfs: use generic Posix ACL code 2009-06-10 17:07:47 +02:00
xfs_attr.c xfs: switch to NOFS allocation under i_lock in xfs_attr_rmtval_get 2009-08-12 01:08:01 -05:00
xfs_attr.h [XFS] Move attr log alloc size calculator to another function. 2008-08-13 16:03:35 +10:00
xfs_attr_leaf.c xfs: remove m_attroffset 2009-03-29 19:26:46 +02:00
xfs_attr_leaf.h [XFS] Remove macro-to-function indirections in attr code 2009-01-09 15:46:44 +11:00
xfs_attr_sf.h [XFS] 2008-07-28 16:58:35 +10:00
xfs_bit.c [XFS] Use the generic bitops rather than implementing them ourselves. 2008-08-13 15:41:12 +10:00
xfs_bit.h [XFS] Remove macro-to-function indirections in the mask code 2009-01-09 15:53:54 +11:00
xfs_bmap.c xfs: add more statics & drop some unused functions 2009-08-31 14:46:20 -05:00
xfs_bmap.h xfs: add more statics & drop some unused functions 2009-08-31 14:46:20 -05:00
xfs_bmap_btree.c xfs: add more statics & drop some unused functions 2009-08-31 14:46:20 -05:00
xfs_bmap_btree.h xfs: add more statics & drop some unused functions 2009-08-31 14:46:20 -05:00
xfs_btree.c xfs: add more statics & drop some unused functions 2009-08-31 14:46:20 -05:00
xfs_btree.h xfs: add more statics & drop some unused functions 2009-08-31 14:46:20 -05:00
xfs_btree_trace.c [XFS] make btree tracing generic 2008-10-30 16:58:50 +11:00
xfs_btree_trace.h [XFS] make btree tracing generic 2008-10-30 16:58:50 +11:00
xfs_buf_item.c [XFS] Remove XFS_BUF_SHUT() and friends 2008-12-22 17:52:58 +11:00
xfs_buf_item.h
xfs_da_btree.c xfs: switch to NOFS allocation under i_lock in xfs_da_buf_make 2009-08-12 01:07:14 -05:00
xfs_da_btree.h xfs: fix various typos 2009-03-29 09:55:42 +02:00
xfs_dfrag.c xfs: implement ->dirty_inode to fix timestamp handling 2009-10-08 12:00:03 -05:00
xfs_dfrag.h [XFS] Move copy_from_user calls out of ioctl helpers into ioctl switch. 2008-12-02 17:08:01 +11:00
xfs_dinode.h xfs: remove m_litino 2009-03-29 09:51:14 +02:00
xfs_dir2.c xfs: switch to NOFS allocation under i_lock in xfs_dir_cilookup_result 2009-08-12 01:07:23 -05:00
xfs_dir2.h [XFS] Return case-insensitive match for dentry cache 2008-07-28 16:58:40 +10:00
xfs_dir2_block.c xfs: kill ino64 mount option 2009-03-29 09:51:08 +02:00
xfs_dir2_block.h
xfs_dir2_data.c [XFS] Name operation vector for hash and compare 2008-07-28 16:58:36 +10:00
xfs_dir2_data.h xfs: fix various typos 2009-03-29 09:55:42 +02:00
xfs_dir2_leaf.c fix readahead calculations in xfs_dir2_leaf_getdents() 2009-10-08 12:02:12 -05:00
xfs_dir2_leaf.h
xfs_dir2_node.c xfs: fix various typos 2009-03-29 09:55:42 +02:00
xfs_dir2_node.h
xfs_dir2_sf.c xfs: kill ino64 mount option 2009-03-29 09:51:08 +02:00
xfs_dir2_sf.h [XFS] kill xfs_dinode_core_t 2008-12-01 11:37:35 +11:00
xfs_dir2_trace.c [XFS] Add op_flags field and helpers to xfs_da_args 2008-07-28 16:58:37 +10:00
xfs_dir2_trace.h
xfs_dmapi.h removed unused #include <linux/version.h>'s 2008-08-23 12:14:12 -07:00
xfs_dmops.c [XFS] kill struct xfs_mount_args 2008-10-30 17:53:24 +11:00
xfs_error.c [XFS] avoid memory allocations in xfs_fs_vcmn_err 2008-12-22 18:02:01 +11:00
xfs_error.h [XFS] avoid memory allocations in xfs_fs_vcmn_err 2008-12-22 18:02:01 +11:00
xfs_extfree_item.c [XFS] Finish removing the mount pointer from the AIL API 2008-10-30 17:39:58 +11:00
xfs_extfree_item.h [XFS] remove always-true #ifndef HAVE_FORMAT32 tests 2009-01-22 14:07:31 +11:00
xfs_filestream.c xfs: split xfs_sync_inodes 2009-06-08 15:35:48 +02:00
xfs_filestream.h
xfs_fs.h trivial: fix typo "for for" in multiple files 2009-09-21 15:14:54 +02:00
xfs_fsops.c xfs: I/O completion handlers must use NOFS allocations 2009-12-11 15:11:20 -06:00
xfs_fsops.h filesystem freeze: add error handling of write_super_lockfs/unlockfs 2009-01-09 16:54:42 -08:00
xfs_ialloc.c xfs: free temporary cursor in xfs_dialloc 2009-10-30 09:27:07 +01:00
xfs_ialloc.h xfs: rationalize xfs_inobt_lookup* 2009-09-01 12:45:39 -05:00
xfs_ialloc_btree.c xfs: fix various typos 2009-03-29 09:55:42 +02:00
xfs_ialloc_btree.h xfs: remove superflous inobt macros 2009-02-09 08:37:14 +01:00
xfs_iget.c xfs: reset the i_iolock lock class in the reclaim path 2009-12-11 15:11:20 -06:00
xfs_inode.c xfs: implement ->dirty_inode to fix timestamp handling 2009-10-08 12:00:03 -05:00
xfs_inode.h xfs: implement ->dirty_inode to fix timestamp handling 2009-10-08 12:00:03 -05:00
xfs_inode_item.c xfs: implement ->dirty_inode to fix timestamp handling 2009-10-08 12:00:03 -05:00
xfs_inode_item.h xfs: simplify xfs_trans_iget 2009-09-01 12:46:16 -05:00
xfs_inum.h xfs: remove XFS_INO64_OFFSET 2009-08-31 14:46:22 -05:00
xfs_iomap.c xfs: I/O completion handlers must use NOFS allocations 2009-12-11 15:11:20 -06:00
xfs_iomap.h xfs: remove xfs_flush_space 2009-04-06 18:49:12 +02:00
xfs_itable.c xfs: implement ->dirty_inode to fix timestamp handling 2009-10-08 12:00:03 -05:00
xfs_itable.h xfs: add more statics & drop some unused functions 2009-08-31 14:46:20 -05:00
xfs_log.c xfs: fix spin_is_locked assert on uni-processor builds 2009-08-12 01:08:27 -05:00
xfs_log.h xfs: cleanup log unmount handling 2009-03-16 08:19:29 +01:00
xfs_log_priv.h xfs: add more statics & drop some unused functions 2009-08-31 14:46:20 -05:00
xfs_log_recover.c xfs: Wrapped journal record corruption on read at recovery 2009-12-11 15:11:21 -06:00
xfs_log_recover.h
xfs_mount.c xfs: I/O completion handlers must use NOFS allocations 2009-12-11 15:11:20 -06:00
xfs_mount.h xfs: add more statics & drop some unused functions 2009-08-31 14:46:20 -05:00
xfs_mru_cache.c xfs: add more statics & drop some unused functions 2009-08-31 14:46:20 -05:00
xfs_mru_cache.h xfs: add more statics & drop some unused functions 2009-08-31 14:46:20 -05:00
xfs_quota.h xfs: fix warnings with CONFIG_XFS_QUOTA disabled 2009-06-12 21:15:12 -05:00
xfs_refcache.h
xfs_rename.c xfs: kill xfs_qmops 2009-06-08 15:33:32 +02:00
xfs_rtalloc.c xfs: make sure to free the real-time inodes in the mount error path 2009-02-04 09:33:58 +01:00
xfs_rtalloc.h xfs: fix various typos 2009-03-29 09:55:42 +02:00
xfs_rw.c xfs: merge fsync and O_SYNC handling 2009-09-01 12:45:57 -05:00
xfs_rw.h xfs: fix mmap_sem/iolock inversion in xfs_free_eofblocks 2009-12-11 15:11:19 -06:00
xfs_sb.h [XFS] Remove the rest of the macro-to-function indirections. 2009-01-19 14:45:55 +11:00
xfs_trans.c xfs: I/O completion handlers must use NOFS allocations 2009-12-11 15:11:20 -06:00
xfs_trans.h xfs: I/O completion handlers must use NOFS allocations 2009-12-11 15:11:20 -06:00
xfs_trans_ail.c xfs: copy li_lsn before dropping AIL lock 2009-11-17 10:26:49 -06:00
xfs_trans_buf.c fs/xfs: Correct redundant test 2009-08-31 14:46:22 -05:00
xfs_trans_extfree.c
xfs_trans_inode.c xfs: simplify xfs_trans_iget 2009-09-01 12:46:16 -05:00
xfs_trans_item.c xfs: fix various typos 2009-03-29 09:55:42 +02:00
xfs_trans_priv.h [XFS] Finish removing the mount pointer from the AIL API 2008-10-30 17:39:58 +11:00
xfs_trans_space.h xfs: remove superflous inobt macros 2009-02-09 08:37:14 +01:00
xfs_types.h xfs: remove uchar_t/ushort_t/uint_t/ulong_t types 2009-02-09 08:37:39 +01:00
xfs_utils.c xfs: kill xfs_qmops 2009-06-08 15:33:32 +02:00
xfs_utils.h [XFS] implement IHOLD/IRELE directly 2008-08-13 16:13:45 +10:00
xfs_vnodeops.c xfs: fix mmap_sem/iolock inversion in xfs_free_eofblocks 2009-12-11 15:11:19 -06:00
xfs_vnodeops.h xfs: simplify inode teardown 2009-12-11 15:11:19 -06:00