Skip to content

Commit 6519f70

Browse files
committed
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 <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent 377bcd5 commit 6519f70

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

fs/xfs/xfs_error.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ xfs_corruption_error(
335335
int linenum,
336336
xfs_failaddr_t failaddr)
337337
{
338-
if (level <= xfs_error_level)
338+
if (buf && level <= xfs_error_level)
339339
xfs_hex_dump(buf, bufsize);
340340
xfs_error_report(tag, level, mp, filename, linenum, failaddr);
341341
xfs_alert(mp, "Corruption detected. Unmount and run xfs_repair");

fs/xfs/xfs_linux.h

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -229,31 +229,26 @@ int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int count,
229229
#define ASSERT(expr) \
230230
(likely(expr) ? (void)0 : assfail(NULL, #expr, __FILE__, __LINE__))
231231

232-
#define XFS_IS_CORRUPT(mp, expr) \
233-
(unlikely(expr) ? assfail((mp), #expr, __FILE__, __LINE__), \
234-
true : false)
235-
236232
#else /* !DEBUG */
237233

238234
#ifdef XFS_WARN
239235

240236
#define ASSERT(expr) \
241237
(likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
242238

243-
#define XFS_IS_CORRUPT(mp, expr) \
244-
(unlikely(expr) ? asswarn((mp), #expr, __FILE__, __LINE__), \
245-
true : false)
246-
247239
#else /* !DEBUG && !XFS_WARN */
248240

249241
#define ASSERT(expr) ((void)0)
250-
#define XFS_IS_CORRUPT(mp, expr) \
251-
(unlikely(expr) ? XFS_ERROR_REPORT(#expr, XFS_ERRLEVEL_LOW, (mp)), \
252-
true : false)
253242

254243
#endif /* XFS_WARN */
255244
#endif /* DEBUG */
256245

246+
#define XFS_IS_CORRUPT(mp, expr) \
247+
(unlikely(expr) ? xfs_corruption_error(#expr, XFS_ERRLEVEL_LOW, (mp), \
248+
NULL, 0, __FILE__, __LINE__, \
249+
__this_address), \
250+
true : false)
251+
257252
#define STATIC static noinline
258253

259254
#ifdef CONFIG_XFS_RT

0 commit comments

Comments
 (0)