aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2011-03-06 18:03:35 -0500
committerDave Chinner <david@fromorbit.com>2011-03-06 18:03:35 -0500
commit65333b4c3d46909872796321d15f179cb0e32028 (patch)
tree8273ccd922f1b9f977b9223636bdd018d977c16a /fs
parent6a19d9393a5402e69fc52f5da8a828b8499a8265 (diff)
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_bmap.c7
-rw-r--r--fs/xfs/xfs_error.c1
-rw-r--r--fs/xfs/xfs_error.h3
-rw-r--r--fs/xfs/xfs_inode.c37
4 files changed, 19 insertions, 29 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 451b4484795d..ded532dc0699 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -4200,12 +4200,11 @@ xfs_bmap_read_extents(
4200 num_recs = xfs_btree_get_numrecs(block); 4200 num_recs = xfs_btree_get_numrecs(block);
4201 if (unlikely(i + num_recs > room)) { 4201 if (unlikely(i + num_recs > room)) {
4202 ASSERT(i + num_recs <= room); 4202 ASSERT(i + num_recs <= room);
4203 xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, 4203 xfs_warn(ip->i_mount,
4204 "corrupt dinode %Lu, (btree extents).", 4204 "corrupt dinode %Lu, (btree extents).",
4205 (unsigned long long) ip->i_ino); 4205 (unsigned long long) ip->i_ino);
4206 XFS_ERROR_REPORT("xfs_bmap_read_extents(1)", 4206 XFS_CORRUPTION_ERROR("xfs_bmap_read_extents(1)",
4207 XFS_ERRLEVEL_LOW, 4207 XFS_ERRLEVEL_LOW, ip->i_mount, block);
4208 ip->i_mount);
4209 goto error0; 4208 goto error0;
4210 } 4209 }
4211 XFS_WANT_CORRUPTED_GOTO( 4210 XFS_WANT_CORRUPTED_GOTO(
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index 34f0e2d264ea..03028906f00e 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -183,4 +183,5 @@ xfs_corruption_error(
183 if (level <= xfs_error_level) 183 if (level <= xfs_error_level)
184 xfs_hex_dump(p, 16); 184 xfs_hex_dump(p, 16);
185 xfs_error_report(tag, level, mp, filename, linenum, ra); 185 xfs_error_report(tag, level, mp, filename, linenum, ra);
186 xfs_alert(mp, "Corruption detected. Unmount and run xfs_repair");
186} 187}
diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
index e1ba2d2565b3..4c8b5007000a 100644
--- a/fs/xfs/xfs_error.h
+++ b/fs/xfs/xfs_error.h
@@ -162,9 +162,6 @@ struct xfs_mount;
162 162
163extern void xfs_hex_dump(void *p, int length); 163extern 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#define xfs_fs_mount_cmn_err(f, fmt, args...) \ 165#define xfs_fs_mount_cmn_err(f, fmt, args...) \
169 do { \ 166 do { \
170 if (!(f & XFS_MFSI_QUIET)) \ 167 if (!(f & XFS_MFSI_QUIET)) \
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index bf9ca579365c..55169bbfc820 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -317,7 +317,7 @@ xfs_iformat(
317 if (unlikely(be32_to_cpu(dip->di_nextents) + 317 if (unlikely(be32_to_cpu(dip->di_nextents) +
318 be16_to_cpu(dip->di_anextents) > 318 be16_to_cpu(dip->di_anextents) >
319 be64_to_cpu(dip->di_nblocks))) { 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 "corrupt dinode %Lu, extent total = %d, nblocks = %Lu.", 321 "corrupt dinode %Lu, extent total = %d, nblocks = %Lu.",
322 (unsigned long long)ip->i_ino, 322 (unsigned long long)ip->i_ino,
323 (int)(be32_to_cpu(dip->di_nextents) + 323 (int)(be32_to_cpu(dip->di_nextents) +
@@ -330,8 +330,7 @@ xfs_iformat(
330 } 330 }
331 331
332 if (unlikely(dip->di_forkoff > ip->i_mount->m_sb.sb_inodesize)) { 332 if (unlikely(dip->di_forkoff > ip->i_mount->m_sb.sb_inodesize)) {
333 xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, 333 xfs_warn(ip->i_mount, "corrupt dinode %Lu, forkoff = 0x%x.",
334 "corrupt dinode %Lu, forkoff = 0x%x.",
335 (unsigned long long)ip->i_ino, 334 (unsigned long long)ip->i_ino,
336 dip->di_forkoff); 335 dip->di_forkoff);
337 XFS_CORRUPTION_ERROR("xfs_iformat(2)", XFS_ERRLEVEL_LOW, 336 XFS_CORRUPTION_ERROR("xfs_iformat(2)", XFS_ERRLEVEL_LOW,
@@ -341,7 +340,7 @@ xfs_iformat(
341 340
342 if (unlikely((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) && 341 if (unlikely((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) &&
343 !ip->i_mount->m_rtdev_targp)) { 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 "corrupt dinode %Lu, has realtime flag set.", 344 "corrupt dinode %Lu, has realtime flag set.",
346 ip->i_ino); 345 ip->i_ino);
347 XFS_CORRUPTION_ERROR("xfs_iformat(realtime)", 346 XFS_CORRUPTION_ERROR("xfs_iformat(realtime)",
@@ -373,9 +372,8 @@ xfs_iformat(
373 * no local regular files yet 372 * no local regular files yet
374 */ 373 */
375 if (unlikely((be16_to_cpu(dip->di_mode) & S_IFMT) == S_IFREG)) { 374 if (unlikely((be16_to_cpu(dip->di_mode) & S_IFMT) == S_IFREG)) {
376 xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, 375 xfs_warn(ip->i_mount,
377 "corrupt inode %Lu " 376 "corrupt inode %Lu (local format for regular file).",
378 "(local format for regular file).",
379 (unsigned long long) ip->i_ino); 377 (unsigned long long) ip->i_ino);
380 XFS_CORRUPTION_ERROR("xfs_iformat(4)", 378 XFS_CORRUPTION_ERROR("xfs_iformat(4)",
381 XFS_ERRLEVEL_LOW, 379 XFS_ERRLEVEL_LOW,
@@ -385,9 +383,8 @@ xfs_iformat(
385 383
386 di_size = be64_to_cpu(dip->di_size); 384 di_size = be64_to_cpu(dip->di_size);
387 if (unlikely(di_size > XFS_DFORK_DSIZE(dip, ip->i_mount))) { 385 if (unlikely(di_size > XFS_DFORK_DSIZE(dip, ip->i_mount))) {
388 xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, 386 xfs_warn(ip->i_mount,
389 "corrupt inode %Lu " 387 "corrupt inode %Lu (bad size %Ld for local inode).",
390 "(bad size %Ld for local inode).",
391 (unsigned long long) ip->i_ino, 388 (unsigned long long) ip->i_ino,
392 (long long) di_size); 389 (long long) di_size);
393 XFS_CORRUPTION_ERROR("xfs_iformat(5)", 390 XFS_CORRUPTION_ERROR("xfs_iformat(5)",
@@ -431,9 +428,8 @@ xfs_iformat(
431 size = be16_to_cpu(atp->hdr.totsize); 428 size = be16_to_cpu(atp->hdr.totsize);
432 429
433 if (unlikely(size < sizeof(struct xfs_attr_sf_hdr))) { 430 if (unlikely(size < sizeof(struct xfs_attr_sf_hdr))) {
434 xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, 431 xfs_warn(ip->i_mount,
435 "corrupt inode %Lu " 432 "corrupt inode %Lu (bad attr fork size %Ld).",
436 "(bad attr fork size %Ld).",
437 (unsigned long long) ip->i_ino, 433 (unsigned long long) ip->i_ino,
438 (long long) size); 434 (long long) size);
439 XFS_CORRUPTION_ERROR("xfs_iformat(8)", 435 XFS_CORRUPTION_ERROR("xfs_iformat(8)",
@@ -488,9 +484,8 @@ xfs_iformat_local(
488 * kmem_alloc() or memcpy() below. 484 * kmem_alloc() or memcpy() below.
489 */ 485 */
490 if (unlikely(size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) { 486 if (unlikely(size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) {
491 xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, 487 xfs_warn(ip->i_mount,
492 "corrupt inode %Lu " 488 "corrupt inode %Lu (bad size %d for local fork, size = %d).",
493 "(bad size %d for local fork, size = %d).",
494 (unsigned long long) ip->i_ino, size, 489 (unsigned long long) ip->i_ino, size,
495 XFS_DFORK_SIZE(dip, ip->i_mount, whichfork)); 490 XFS_DFORK_SIZE(dip, ip->i_mount, whichfork));
496 XFS_CORRUPTION_ERROR("xfs_iformat_local", XFS_ERRLEVEL_LOW, 491 XFS_CORRUPTION_ERROR("xfs_iformat_local", XFS_ERRLEVEL_LOW,
@@ -547,8 +542,7 @@ xfs_iformat_extents(
547 * kmem_alloc() or memcpy() below. 542 * kmem_alloc() or memcpy() below.
548 */ 543 */
549 if (unlikely(size < 0 || size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) { 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, 545 xfs_warn(ip->i_mount, "corrupt inode %Lu ((a)extents = %d).",
551 "corrupt inode %Lu ((a)extents = %d).",
552 (unsigned long long) ip->i_ino, nex); 546 (unsigned long long) ip->i_ino, nex);
553 XFS_CORRUPTION_ERROR("xfs_iformat_extents(1)", XFS_ERRLEVEL_LOW, 547 XFS_CORRUPTION_ERROR("xfs_iformat_extents(1)", XFS_ERRLEVEL_LOW,
554 ip->i_mount, dip); 548 ip->i_mount, dip);
@@ -623,11 +617,10 @@ xfs_iformat_btree(
623 || XFS_BMDR_SPACE_CALC(nrecs) > 617 || XFS_BMDR_SPACE_CALC(nrecs) >
624 XFS_DFORK_SIZE(dip, ip->i_mount, whichfork) 618 XFS_DFORK_SIZE(dip, ip->i_mount, whichfork)
625 || XFS_IFORK_NEXTENTS(ip, whichfork) > ip->i_d.di_nblocks)) { 619 || XFS_IFORK_NEXTENTS(ip, whichfork) > ip->i_d.di_nblocks)) {
626 xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, 620 xfs_warn(ip->i_mount, "corrupt inode %Lu (btree).",
627 "corrupt inode %Lu (btree).",
628 (unsigned long long) ip->i_ino); 621 (unsigned long long) ip->i_ino);
629 XFS_ERROR_REPORT("xfs_iformat_btree", XFS_ERRLEVEL_LOW, 622 XFS_CORRUPTION_ERROR("xfs_iformat_btree", XFS_ERRLEVEL_LOW,
630 ip->i_mount); 623 ip->i_mount, dip);
631 return XFS_ERROR(EFSCORRUPTED); 624 return XFS_ERROR(EFSCORRUPTED);
632 } 625 }
633 626