linux/fs/xfs
Dave Chinner e09f98606d xfs: xfs_swap_extents needs to handle dynamic fork offsets
When swapping extents, we can corrupt inodes by swapping data forks
that are in incompatible formats.  This is caused by the two indoes
having different fork offsets due to the presence of an attribute
fork on an attr2 filesystem.  xfs_fsr tries to be smart about
setting the fork offset, but the trick it plays only works on attr1
(old fixed format attribute fork) filesystems.

Changing the way xfs_fsr sets up the attribute fork will prevent
this situation from ever occurring, so in the kernel code we can get
by with a preventative fix - check that the data fork in the
defragmented inode is in a format valid for the inode it is being
swapped into.  This will lead to files that will silently and
potentially repeatedly fail defragmentation, so issue a warning to
the log when this particular failure occurs to let us know that
xfs_fsr needs updating/fixing.

To help identify how to improve xfs_fsr to avoid this issue, add
trace points for the inodes being swapped so that we can determine
why the swap was rejected and to confirm that the code is making the
right decisions and modifications when swapping forks.

A further complication is even when the swap is allowed to proceed
when the fork offset is different between the two inodes then value
for the maximum number of extents the data fork can hold can be
wrong. Make sure these are also set correctly after the swap occurs.

Signed-off-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
2010-01-15 13:49:07 -06:00
..
linux-2.6 xfs: reclaim all inodes by background tree walks 2010-01-15 13:44:44 -06:00
quota xfs: reclaim inodes under a write lock 2010-01-15 13:43:55 -06:00
support xfs: event tracing support 2009-12-14 23:08:16 -06:00
Kconfig
Makefile xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_acl.h sanitize xattr handler prototypes 2009-12-16 12:16:49 -05:00
xfs_ag.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_alloc_btree.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_alloc_btree.h
xfs_alloc.c xfs: Ensure we force all busy extents in range to disk 2010-01-10 12:22:02 -06:00
xfs_alloc.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_arch.h
xfs_attr_leaf.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_attr_leaf.h
xfs_attr_sf.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_attr.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_attr.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_bit.c
xfs_bit.h
xfs_bmap_btree.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_bmap_btree.h xfs: kill xfs_bmbt_rec_32/64 types 2009-12-16 13:41:20 -06:00
xfs_bmap.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_bmap.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_btree_trace.c
xfs_btree_trace.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_btree.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_btree.h
xfs_buf_item.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_buf_item.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_da_btree.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_da_btree.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_dfrag.c xfs: xfs_swap_extents needs to handle dynamic fork offsets 2010-01-15 13:49:07 -06:00
xfs_dfrag.h
xfs_dinode.h
xfs_dir2_block.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_dir2_block.h
xfs_dir2_data.c
xfs_dir2_data.h
xfs_dir2_leaf.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_dir2_leaf.h
xfs_dir2_node.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_dir2_node.h
xfs_dir2_sf.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_dir2_sf.h
xfs_dir2.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_dir2.h
xfs_dmapi.h
xfs_dmops.c
xfs_error.c
xfs_error.h
xfs_extfree_item.c
xfs_extfree_item.h
xfs_filestream.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_filestream.h xfs: kill the STATIC_INLINE macro 2009-12-11 15:11:22 -06:00
xfs_fs.h
xfs_fsops.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_fsops.h
xfs_ialloc_btree.c
xfs_ialloc_btree.h
xfs_ialloc.c xfs: kill the STATIC_INLINE macro 2009-12-11 15:11:22 -06:00
xfs_ialloc.h
xfs_iget.c xfs: Remove inode iolock held check during allocation 2010-01-15 13:45:33 -06:00
xfs_inode_item.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_inode_item.h xfs: kill xfs_bmbt_rec_32/64 types 2009-12-16 13:41:20 -06:00
xfs_inode.c xfs: fix stale inode flush avoidance 2010-01-15 13:46:02 -06:00
xfs_inode.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_inum.h
xfs_iomap.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_iomap.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_itable.c xfs: implement ->dirty_inode to fix timestamp handling 2009-10-08 12:00:03 -05:00
xfs_itable.h
xfs_log_priv.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_log_recover.c Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs 2009-12-15 09:12:43 -08:00
xfs_log_recover.h
xfs_log.c xfs: improve metadata I/O merging in the elevator 2009-12-16 13:41:19 -06:00
xfs_log.h
xfs_mount.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_mount.h xfs: cleanup dmapi macros in the umount path 2009-12-11 15:11:23 -06:00
xfs_mru_cache.c
xfs_mru_cache.h
xfs_quota.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_refcache.h
xfs_rename.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_rtalloc.c xfs: fix missing error check in xfs_rtfree_range 2010-01-15 13:46:19 -06:00
xfs_rtalloc.h
xfs_rw.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_rw.h xfs: uninline xfs_get_extsz_hint 2009-12-11 15:11:22 -06:00
xfs_sb.h
xfs_trans_ail.c xfs: copy li_lsn before dropping AIL lock 2009-11-17 10:26:49 -06:00
xfs_trans_buf.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_trans_extfree.c
xfs_trans_inode.c
xfs_trans_item.c
xfs_trans_priv.h
xfs_trans_space.h
xfs_trans.c xfs: I/O completion handlers must use NOFS allocations 2009-12-11 15:11:20 -06:00
xfs_trans.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_types.h
xfs_utils.c
xfs_utils.h
xfs_vnodeops.c xfs: fix timestamp handling in xfs_setattr 2010-01-10 12:21:58 -06:00
xfs_vnodeops.h xfs: simplify inode teardown 2009-12-11 15:11:19 -06:00
xfs.h xfs: event tracing support 2009-12-14 23:08:16 -06:00