[RFC v2 0/2] xfs: detect and warn about invalid metadata lsns

Brian Foster
2015-09-11T18:53:58Z

Hi all,

Here's a second rfc pass at the kernel side of invalid metadata LSN
detection for v5 supers. This is an rfc simply because my understanding
is that the userspace code should probably go first so that the tools
for repair are available before the kernel starts detecting and warning
about this problem.

The primary change in this version is how the problem is handled once
detected. I've been a bit undecided on whether a shutdown is really
warranted because if the fs doesn't crash, it will eventually
self-correct. On the flipside, a WARN_ON_ONCE() is not sufficient
because it could suppress warnings on separate filesystems once one
filesystem has encountered the issue and fired a warning.

Therefore, this version uses something of a happy medium. The filesystem
is not shutdown but a mount flag is used to warn about the problem at
least once per-mount. Any instances thereafter are ratelimited to a once
per 24 hour period.

Brian

rfcv2:
- Refactored lsn validation and warning code into separate helpers.
- Updated warning mechanism to warn at least once per fs (ratelimited
thereafter).
- No longer shutdown the fs on invalid metadata lsn detection.
rfcv1: http://oss.sgi.com/pipermail/xfs/2015-August/043396.html

Brian Foster (2):
xfs: create a daily warning mechanism
xfs: validate metadata LSNs against log on v5 superblocks

fs/xfs/libxfs/xfs_alloc.c | 9 +++++--
fs/xfs/libxfs/xfs_attr_leaf.c | 2 ++
fs/xfs/libxfs/xfs_btree.c | 14 +++++++++--
fs/xfs/libxfs/xfs_da_btree.c | 3 +++
fs/xfs/libxfs/xfs_dir2_block.c | 1 +
fs/xfs/libxfs/xfs_dir2_data.c | 1 +
fs/xfs/libxfs/xfs_dir2_leaf.c | 1 +
fs/xfs/libxfs/xfs_dir2_node.c | 1 +
fs/xfs/libxfs/xfs_ialloc.c | 8 +++++--
fs/xfs/libxfs/xfs_sb.c | 8 +++++++
fs/xfs/libxfs/xfs_symlink_remote.c | 3 +++
fs/xfs/xfs_log.c | 1 -
fs/xfs/xfs_log_priv.h | 24 +++++++++++++++++++
fs/xfs/xfs_log_recover.c | 15 +++++++++++-
fs/xfs/xfs_message.h | 18 ++++++++++----
fs/xfs/xfs_mount.c | 49 ++++++++++++++++++++++++++++++++++++++
fs/xfs/xfs_mount.h | 3 +++
17 files changed, 149 insertions(+), 12 deletions(-)