Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xfs: Introduce XFS_PTAG_VERIFIER_ERROR panic mask

Currently we have a few PTAGs in place allowing us to transform a filesystem
error in a BUG() call. However, we don't have a panic tag for corrupt
metadata, so introduce XFS_PTAG_VERIFIER_ERROR so that the administrator can
use the fs.xfs.panic_mask sysctl knob to convert any error detected by buffer
verifiers into a kernel panic.

Signed-off-by: Marco Benatto <mbenatto@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
[darrick: light editing of commit message]
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

authored by

Marco Benatto and committed by
Darrick J. Wong
d519da41 e88db816

+6 -3
+2 -1
Documentation/filesystems/xfs.txt
··· 272 272 XFS_ERRLEVEL_LOW: 1 273 273 XFS_ERRLEVEL_HIGH: 5 274 274 275 - fs.xfs.panic_mask (Min: 0 Default: 0 Max: 255) 275 + fs.xfs.panic_mask (Min: 0 Default: 0 Max: 256) 276 276 Causes certain error conditions to call BUG(). Value is a bitmask; 277 277 OR together the tags which represent errors which should cause panics: 278 278 ··· 285 285 XFS_PTAG_SHUTDOWN_IOERROR 0x00000020 286 286 XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040 287 287 XFS_PTAG_FSBLOCK_ZERO 0x00000080 288 + XFS_PTAG_VERIFIER_ERROR 0x00000100 288 289 289 290 This option is intended for debugging only. 290 291
+2 -1
fs/xfs/xfs_error.c
··· 357 357 fa = failaddr ? failaddr : __return_address; 358 358 __xfs_buf_ioerror(bp, error, fa); 359 359 360 - xfs_alert(mp, "Metadata %s detected at %pS, %s block 0x%llx %s", 360 + xfs_alert_tag(mp, XFS_PTAG_VERIFIER_ERROR, 361 + "Metadata %s detected at %pS, %s block 0x%llx %s", 361 362 bp->b_error == -EFSBADCRC ? "CRC error" : "corruption", 362 363 fa, bp->b_ops->name, bp->b_bn, name); 363 364
+1
fs/xfs/xfs_error.h
··· 98 98 #define XFS_PTAG_SHUTDOWN_IOERROR 0x00000020 99 99 #define XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040 100 100 #define XFS_PTAG_FSBLOCK_ZERO 0x00000080 101 + #define XFS_PTAG_VERIFIER_ERROR 0x00000100 101 102 102 103 #endif /* __XFS_ERROR_H__ */
+1 -1
fs/xfs/xfs_globals.c
··· 16 16 /* MIN DFLT MAX */ 17 17 .sgid_inherit = { 0, 0, 1 }, 18 18 .symlink_mode = { 0, 0, 1 }, 19 - .panic_mask = { 0, 0, 255 }, 19 + .panic_mask = { 0, 0, 256 }, 20 20 .error_level = { 0, 3, 11 }, 21 21 .syncd_timer = { 1*100, 30*100, 7200*100}, 22 22 .stats_clear = { 0, 0, 1 },