Commit 65333b4c3d46909872796321d15f179cb0e32028

Authored by Dave Chinner
Committed by Dave Chinner
1 parent 6a19d9393a

xfs: kill xfs_fs_repair_cmn_err() macro

In certain cases of inode corruption, the xfs_fs_repair_cmn_err()
macro is used to output an extra message in the corruption report.
That extra message is "unmount and run xfs_repair", which really
applies to any corruption report. Each case that this macro is
called (except one) a following call to xfs_corruption_error() is
made to optionally dump more information about the error.

Hence, move the output of "run xfs_repair" to xfs_corruption_error()
so that it is output on all corruption reports.  Also, convert the
callers of the repair macro that don't call xfs_corruption_error()
to call it, hence provide consiѕtent error reporting for all cases
where xfs_fs_repair_cmn_err() used to be called.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>

Showing 4 changed files with 19 additions and 29 deletions Side-by-side Diff

... ... @@ -4200,12 +4200,11 @@
4200 4200 num_recs = xfs_btree_get_numrecs(block);
4201 4201 if (unlikely(i + num_recs > room)) {
4202 4202 ASSERT(i + num_recs <= room);
4203   - xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
  4203 + xfs_warn(ip->i_mount,
4204 4204 "corrupt dinode %Lu, (btree extents).",
4205 4205 (unsigned long long) ip->i_ino);
4206   - XFS_ERROR_REPORT("xfs_bmap_read_extents(1)",
4207   - XFS_ERRLEVEL_LOW,
4208   - ip->i_mount);
  4206 + XFS_CORRUPTION_ERROR("xfs_bmap_read_extents(1)",
  4207 + XFS_ERRLEVEL_LOW, ip->i_mount, block);
4209 4208 goto error0;
4210 4209 }
4211 4210 XFS_WANT_CORRUPTED_GOTO(
... ... @@ -183,5 +183,6 @@
183 183 if (level <= xfs_error_level)
184 184 xfs_hex_dump(p, 16);
185 185 xfs_error_report(tag, level, mp, filename, linenum, ra);
  186 + xfs_alert(mp, "Corruption detected. Unmount and run xfs_repair");
186 187 }
... ... @@ -162,9 +162,6 @@
162 162  
163 163 extern void xfs_hex_dump(void *p, int length);
164 164  
165   -#define xfs_fs_repair_cmn_err(level, mp, fmt, args...) \
166   - xfs_fs_cmn_err(level, mp, fmt " Unmount and run xfs_repair.", ## args)
167   -
168 165 #define xfs_fs_mount_cmn_err(f, fmt, args...) \
169 166 do { \
170 167 if (!(f & XFS_MFSI_QUIET)) \
... ... @@ -317,7 +317,7 @@
317 317 if (unlikely(be32_to_cpu(dip->di_nextents) +
318 318 be16_to_cpu(dip->di_anextents) >
319 319 be64_to_cpu(dip->di_nblocks))) {
320   - xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
  320 + xfs_warn(ip->i_mount,
321 321 "corrupt dinode %Lu, extent total = %d, nblocks = %Lu.",
322 322 (unsigned long long)ip->i_ino,
323 323 (int)(be32_to_cpu(dip->di_nextents) +
... ... @@ -330,8 +330,7 @@
330 330 }
331 331  
332 332 if (unlikely(dip->di_forkoff > ip->i_mount->m_sb.sb_inodesize)) {
333   - xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
334   - "corrupt dinode %Lu, forkoff = 0x%x.",
  333 + xfs_warn(ip->i_mount, "corrupt dinode %Lu, forkoff = 0x%x.",
335 334 (unsigned long long)ip->i_ino,
336 335 dip->di_forkoff);
337 336 XFS_CORRUPTION_ERROR("xfs_iformat(2)", XFS_ERRLEVEL_LOW,
... ... @@ -341,7 +340,7 @@
341 340  
342 341 if (unlikely((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) &&
343 342 !ip->i_mount->m_rtdev_targp)) {
344   - xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
  343 + xfs_warn(ip->i_mount,
345 344 "corrupt dinode %Lu, has realtime flag set.",
346 345 ip->i_ino);
347 346 XFS_CORRUPTION_ERROR("xfs_iformat(realtime)",
... ... @@ -373,9 +372,8 @@
373 372 * no local regular files yet
374 373 */
375 374 if (unlikely((be16_to_cpu(dip->di_mode) & S_IFMT) == S_IFREG)) {
376   - xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
377   - "corrupt inode %Lu "
378   - "(local format for regular file).",
  375 + xfs_warn(ip->i_mount,
  376 + "corrupt inode %Lu (local format for regular file).",
379 377 (unsigned long long) ip->i_ino);
380 378 XFS_CORRUPTION_ERROR("xfs_iformat(4)",
381 379 XFS_ERRLEVEL_LOW,
... ... @@ -385,9 +383,8 @@
385 383  
386 384 di_size = be64_to_cpu(dip->di_size);
387 385 if (unlikely(di_size > XFS_DFORK_DSIZE(dip, ip->i_mount))) {
388   - xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
389   - "corrupt inode %Lu "
390   - "(bad size %Ld for local inode).",
  386 + xfs_warn(ip->i_mount,
  387 + "corrupt inode %Lu (bad size %Ld for local inode).",
391 388 (unsigned long long) ip->i_ino,
392 389 (long long) di_size);
393 390 XFS_CORRUPTION_ERROR("xfs_iformat(5)",
... ... @@ -431,9 +428,8 @@
431 428 size = be16_to_cpu(atp->hdr.totsize);
432 429  
433 430 if (unlikely(size < sizeof(struct xfs_attr_sf_hdr))) {
434   - xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
435   - "corrupt inode %Lu "
436   - "(bad attr fork size %Ld).",
  431 + xfs_warn(ip->i_mount,
  432 + "corrupt inode %Lu (bad attr fork size %Ld).",
437 433 (unsigned long long) ip->i_ino,
438 434 (long long) size);
439 435 XFS_CORRUPTION_ERROR("xfs_iformat(8)",
... ... @@ -488,9 +484,8 @@
488 484 * kmem_alloc() or memcpy() below.
489 485 */
490 486 if (unlikely(size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) {
491   - xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
492   - "corrupt inode %Lu "
493   - "(bad size %d for local fork, size = %d).",
  487 + xfs_warn(ip->i_mount,
  488 + "corrupt inode %Lu (bad size %d for local fork, size = %d).",
494 489 (unsigned long long) ip->i_ino, size,
495 490 XFS_DFORK_SIZE(dip, ip->i_mount, whichfork));
496 491 XFS_CORRUPTION_ERROR("xfs_iformat_local", XFS_ERRLEVEL_LOW,
... ... @@ -547,8 +542,7 @@
547 542 * kmem_alloc() or memcpy() below.
548 543 */
549 544 if (unlikely(size < 0 || size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) {
550   - xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
551   - "corrupt inode %Lu ((a)extents = %d).",
  545 + xfs_warn(ip->i_mount, "corrupt inode %Lu ((a)extents = %d).",
552 546 (unsigned long long) ip->i_ino, nex);
553 547 XFS_CORRUPTION_ERROR("xfs_iformat_extents(1)", XFS_ERRLEVEL_LOW,
554 548 ip->i_mount, dip);
555 549  
... ... @@ -623,11 +617,10 @@
623 617 || XFS_BMDR_SPACE_CALC(nrecs) >
624 618 XFS_DFORK_SIZE(dip, ip->i_mount, whichfork)
625 619 || XFS_IFORK_NEXTENTS(ip, whichfork) > ip->i_d.di_nblocks)) {
626   - xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
627   - "corrupt inode %Lu (btree).",
  620 + xfs_warn(ip->i_mount, "corrupt inode %Lu (btree).",
628 621 (unsigned long long) ip->i_ino);
629   - XFS_ERROR_REPORT("xfs_iformat_btree", XFS_ERRLEVEL_LOW,
630   - ip->i_mount);
  622 + XFS_CORRUPTION_ERROR("xfs_iformat_btree", XFS_ERRLEVEL_LOW,
  623 + ip->i_mount, dip);
631 624 return XFS_ERROR(EFSCORRUPTED);
632 625 }
633 626