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

xfs: report corruption only as a regular error

Redefine XFS_IS_CORRUPT so that it reports corruptions only via
xfs_corruption_report. Since these are on-disk contents (and not checks
of internal state), we don't ever want to panic the kernel. This also
amends the corruption report to recommend unmounting and running
xfs_repair.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>

+7 -12
+1 -1
fs/xfs/xfs_error.c
··· 335 335 int linenum, 336 336 xfs_failaddr_t failaddr) 337 337 { 338 - if (level <= xfs_error_level) 338 + if (buf && level <= xfs_error_level) 339 339 xfs_hex_dump(buf, bufsize); 340 340 xfs_error_report(tag, level, mp, filename, linenum, failaddr); 341 341 xfs_alert(mp, "Corruption detected. Unmount and run xfs_repair");
+6 -11
fs/xfs/xfs_linux.h
··· 229 229 #define ASSERT(expr) \ 230 230 (likely(expr) ? (void)0 : assfail(NULL, #expr, __FILE__, __LINE__)) 231 231 232 - #define XFS_IS_CORRUPT(mp, expr) \ 233 - (unlikely(expr) ? assfail((mp), #expr, __FILE__, __LINE__), \ 234 - true : false) 235 - 236 232 #else /* !DEBUG */ 237 233 238 234 #ifdef XFS_WARN ··· 236 240 #define ASSERT(expr) \ 237 241 (likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__)) 238 242 239 - #define XFS_IS_CORRUPT(mp, expr) \ 240 - (unlikely(expr) ? asswarn((mp), #expr, __FILE__, __LINE__), \ 241 - true : false) 242 - 243 243 #else /* !DEBUG && !XFS_WARN */ 244 244 245 245 #define ASSERT(expr) ((void)0) 246 - #define XFS_IS_CORRUPT(mp, expr) \ 247 - (unlikely(expr) ? XFS_ERROR_REPORT(#expr, XFS_ERRLEVEL_LOW, (mp)), \ 248 - true : false) 249 246 250 247 #endif /* XFS_WARN */ 251 248 #endif /* DEBUG */ 249 + 250 + #define XFS_IS_CORRUPT(mp, expr) \ 251 + (unlikely(expr) ? xfs_corruption_error(#expr, XFS_ERRLEVEL_LOW, (mp), \ 252 + NULL, 0, __FILE__, __LINE__, \ 253 + __this_address), \ 254 + true : false) 252 255 253 256 #define STATIC static noinline 254 257