linux/fs/xfs/libxfs
Brian Foster a45086e27d xfs: validate metadata LSNs against log on v5 superblocks
Since the onset of v5 superblocks, the LSN of the last modification has
been included in a variety of on-disk data structures. This LSN is used
to provide log recovery ordering guarantees (e.g., to ensure an older
log recovery item is not replayed over a newer target data structure).

While this works correctly from the point a filesystem is formatted and
mounted, userspace tools have some problematic behaviors that defeat
this mechanism. For example, xfs_repair historically zeroes out the log
unconditionally (regardless of whether corruption is detected). If this
occurs, the LSN of the filesystem is reset and the log is now in a
problematic state with respect to on-disk metadata structures that might
have a larger LSN. Until either the log catches up to the highest
previously used metadata LSN or each affected data structure is modified
and written out without incident (which resets the metadata LSN), log
recovery is susceptible to filesystem corruption.

This problem is ultimately addressed and repaired in the associated
userspace tools. The kernel is still responsible to detect the problem
and notify the user that something is wrong. Check the superblock LSN at
mount time and fail the mount if it is invalid. From that point on,
trigger verifier failure on any metadata I/O where an invalid LSN is
detected. This results in a filesystem shutdown and guarantees that we
do not log metadata changes with invalid LSNs on disk. Since this is a
known issue with a known recovery path, present a warning to instruct
the user how to recover.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-10-12 15:59:25 +11:00
..
xfs_alloc_btree.c xfs: create new metadata UUID field and incompat flag 2015-07-29 11:53:31 +10:00
xfs_alloc_btree.h
xfs_alloc.c xfs: validate metadata LSNs against log on v5 superblocks 2015-10-12 15:59:25 +11:00
xfs_alloc.h Merge branch 'xfs-freelist-cleanup' into for-next 2015-06-23 08:48:43 +10:00
xfs_attr_leaf.c xfs: validate metadata LSNs against log on v5 superblocks 2015-10-12 15:59:25 +11:00
xfs_attr_leaf.h xfs: xfs_attr_inactive leaves inconsistent attr fork state behind 2015-05-29 07:40:08 +10:00
xfs_attr_remote.c Merge branch 'xfs-meta-uuid' into for-next 2015-07-29 11:54:21 +10:00
xfs_attr_remote.h
xfs_attr_sf.h
xfs_attr.c xfs: set XFS_DA_OP_OKNOENT in xfs_attr_get 2015-08-19 10:30:48 +10:00
xfs_bit.c libxfs: add xfs_bit.c 2015-07-29 11:52:08 +10:00
xfs_bit.h
xfs_bmap_btree.c xfs: create new metadata UUID field and incompat flag 2015-07-29 11:53:31 +10:00
xfs_bmap_btree.h
xfs_bmap.c xfs: log local to remote symlink conversions correctly on v5 supers 2015-10-12 15:40:24 +11:00
xfs_bmap.h xfs: Add support FALLOC_FL_INSERT_RANGE for fallocate 2015-03-25 15:08:56 +11:00
xfs_btree.c xfs: validate metadata LSNs against log on v5 superblocks 2015-10-12 15:59:25 +11:00
xfs_btree.h xfs: require 64-bit sector_t 2014-07-30 09:12:05 +10:00
xfs_cksum.h
xfs_da_btree.c xfs: validate metadata LSNs against log on v5 superblocks 2015-10-12 15:59:25 +11:00
xfs_da_btree.h
xfs_da_format.c xfs: move most of xfs_sb.h to xfs_format.h 2014-11-28 14:27:09 +11:00
xfs_da_format.h xfs: Fix xfs_attr_leafblock definition 2015-08-19 10:34:32 +10:00
xfs_dir2_block.c xfs: validate metadata LSNs against log on v5 superblocks 2015-10-12 15:59:25 +11:00
xfs_dir2_data.c xfs: validate metadata LSNs against log on v5 superblocks 2015-10-12 15:59:25 +11:00
xfs_dir2_leaf.c xfs: validate metadata LSNs against log on v5 superblocks 2015-10-12 15:59:25 +11:00
xfs_dir2_node.c xfs: validate metadata LSNs against log on v5 superblocks 2015-10-12 15:59:25 +11:00
xfs_dir2_priv.h xfs: move type conversion functions to xfs_dir.h 2014-12-04 09:43:17 +11:00
xfs_dir2_sf.c Merge branch 'xfs-misc-fixes-for-3.19-2' into for-next 2014-12-04 09:46:17 +11:00
xfs_dir2.c Merge branch 'xfs-misc-fixes-for-4.3-2' into for-next 2015-08-20 09:28:45 +10:00
xfs_dir2.h xfs: move type conversion functions to xfs_dir.h 2014-12-04 09:43:17 +11:00
xfs_dquot_buf.c xfs: create new metadata UUID field and incompat flag 2015-07-29 11:53:31 +10:00
xfs_format.h xfs: create new metadata UUID field and incompat flag 2015-07-29 11:53:31 +10:00
xfs_fs.h xfs: add fs geometry bit for sparse inode chunks 2015-05-29 08:58:32 +10:00
xfs_ialloc_btree.c xfs: create new metadata UUID field and incompat flag 2015-07-29 11:53:31 +10:00
xfs_ialloc_btree.h xfs: allocate sparse inode chunks on full chunk allocation failure 2015-05-29 09:18:32 +10:00
xfs_ialloc.c xfs: validate metadata LSNs against log on v5 superblocks 2015-10-12 15:59:25 +11:00
xfs_ialloc.h Merge branch 'xfs-misc-fixes-for-4.2-3' into for-next 2015-06-23 08:49:01 +10:00
xfs_inode_buf.c xfs: create new metadata UUID field and incompat flag 2015-07-29 11:53:31 +10:00
xfs_inode_buf.h
xfs_inode_fork.c xfs: merge xfs_inum.h into xfs_format.h 2014-11-28 14:27:10 +11:00
xfs_inode_fork.h
xfs_log_format.h xfs: merge xfs_dinode.h into xfs_format.h 2014-11-28 14:24:06 +11:00
xfs_log_recover.h
xfs_log_rlimit.c xfs: move most of xfs_sb.h to xfs_format.h 2014-11-28 14:27:09 +11:00
xfs_quota_defs.h
xfs_rtbitmap.c xfs: move most of xfs_sb.h to xfs_format.h 2014-11-28 14:27:09 +11:00
xfs_sb.c xfs: validate metadata LSNs against log on v5 superblocks 2015-10-12 15:59:25 +11:00
xfs_sb.h xfs: consolidate superblock logging functions 2015-01-22 09:10:31 +11:00
xfs_shared.h xfs: saner xfs_trans_commit interface 2015-06-04 13:48:08 +10:00
xfs_symlink_remote.c xfs: validate metadata LSNs against log on v5 superblocks 2015-10-12 15:59:25 +11:00
xfs_trans_resv.c xfs: consolidate superblock logging functions 2015-01-22 09:10:31 +11:00
xfs_trans_resv.h xfs: clean up XFS_MIN_FREELIST macros 2015-06-22 10:13:30 +10:00
xfs_trans_space.h xfs: clean up XFS_MIN_FREELIST macros 2015-06-22 10:13:30 +10:00
xfs_types.h xfs: move xfs_types.h to libxfs 2015-01-09 10:46:31 +11:00