Commit 65333b4c authored by Dave Chinner's avatar Dave Chinner Committed by Dave Chinner

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: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 6a19d939
...@@ -4200,12 +4200,11 @@ xfs_bmap_read_extents( ...@@ -4200,12 +4200,11 @@ xfs_bmap_read_extents(
num_recs = xfs_btree_get_numrecs(block); num_recs = xfs_btree_get_numrecs(block);
if (unlikely(i + num_recs > room)) { if (unlikely(i + num_recs > room)) {
ASSERT(i + num_recs <= room); ASSERT(i + num_recs <= room);
xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, xfs_warn(ip->i_mount,
"corrupt dinode %Lu, (btree extents).", "corrupt dinode %Lu, (btree extents).",
(unsigned long long) ip->i_ino); (unsigned long long) ip->i_ino);
XFS_ERROR_REPORT("xfs_bmap_read_extents(1)", XFS_CORRUPTION_ERROR("xfs_bmap_read_extents(1)",
XFS_ERRLEVEL_LOW, XFS_ERRLEVEL_LOW, ip->i_mount, block);
ip->i_mount);
goto error0; goto error0;
} }
XFS_WANT_CORRUPTED_GOTO( XFS_WANT_CORRUPTED_GOTO(
......
...@@ -183,4 +183,5 @@ xfs_corruption_error( ...@@ -183,4 +183,5 @@ xfs_corruption_error(
if (level <= xfs_error_level) if (level <= xfs_error_level)
xfs_hex_dump(p, 16); xfs_hex_dump(p, 16);
xfs_error_report(tag, level, mp, filename, linenum, ra); xfs_error_report(tag, level, mp, filename, linenum, ra);
xfs_alert(mp, "Corruption detected. Unmount and run xfs_repair");
} }
...@@ -162,9 +162,6 @@ struct xfs_mount; ...@@ -162,9 +162,6 @@ struct xfs_mount;
extern void xfs_hex_dump(void *p, int length); extern void xfs_hex_dump(void *p, int length);
#define xfs_fs_repair_cmn_err(level, mp, fmt, args...) \
xfs_fs_cmn_err(level, mp, fmt " Unmount and run xfs_repair.", ## args)
#define xfs_fs_mount_cmn_err(f, fmt, args...) \ #define xfs_fs_mount_cmn_err(f, fmt, args...) \
do { \ do { \
if (!(f & XFS_MFSI_QUIET)) \ if (!(f & XFS_MFSI_QUIET)) \
......
...@@ -317,7 +317,7 @@ xfs_iformat( ...@@ -317,7 +317,7 @@ xfs_iformat(
if (unlikely(be32_to_cpu(dip->di_nextents) + if (unlikely(be32_to_cpu(dip->di_nextents) +
be16_to_cpu(dip->di_anextents) > be16_to_cpu(dip->di_anextents) >
be64_to_cpu(dip->di_nblocks))) { be64_to_cpu(dip->di_nblocks))) {
xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, xfs_warn(ip->i_mount,
"corrupt dinode %Lu, extent total = %d, nblocks = %Lu.", "corrupt dinode %Lu, extent total = %d, nblocks = %Lu.",
(unsigned long long)ip->i_ino, (unsigned long long)ip->i_ino,
(int)(be32_to_cpu(dip->di_nextents) + (int)(be32_to_cpu(dip->di_nextents) +
...@@ -330,8 +330,7 @@ xfs_iformat( ...@@ -330,8 +330,7 @@ xfs_iformat(
} }
if (unlikely(dip->di_forkoff > ip->i_mount->m_sb.sb_inodesize)) { if (unlikely(dip->di_forkoff > ip->i_mount->m_sb.sb_inodesize)) {
xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, xfs_warn(ip->i_mount, "corrupt dinode %Lu, forkoff = 0x%x.",
"corrupt dinode %Lu, forkoff = 0x%x.",
(unsigned long long)ip->i_ino, (unsigned long long)ip->i_ino,
dip->di_forkoff); dip->di_forkoff);
XFS_CORRUPTION_ERROR("xfs_iformat(2)", XFS_ERRLEVEL_LOW, XFS_CORRUPTION_ERROR("xfs_iformat(2)", XFS_ERRLEVEL_LOW,
...@@ -341,7 +340,7 @@ xfs_iformat( ...@@ -341,7 +340,7 @@ xfs_iformat(
if (unlikely((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) && if (unlikely((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) &&
!ip->i_mount->m_rtdev_targp)) { !ip->i_mount->m_rtdev_targp)) {
xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, xfs_warn(ip->i_mount,
"corrupt dinode %Lu, has realtime flag set.", "corrupt dinode %Lu, has realtime flag set.",
ip->i_ino); ip->i_ino);
XFS_CORRUPTION_ERROR("xfs_iformat(realtime)", XFS_CORRUPTION_ERROR("xfs_iformat(realtime)",
...@@ -373,9 +372,8 @@ xfs_iformat( ...@@ -373,9 +372,8 @@ xfs_iformat(
* no local regular files yet * no local regular files yet
*/ */
if (unlikely((be16_to_cpu(dip->di_mode) & S_IFMT) == S_IFREG)) { if (unlikely((be16_to_cpu(dip->di_mode) & S_IFMT) == S_IFREG)) {
xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, xfs_warn(ip->i_mount,
"corrupt inode %Lu " "corrupt inode %Lu (local format for regular file).",
"(local format for regular file).",
(unsigned long long) ip->i_ino); (unsigned long long) ip->i_ino);
XFS_CORRUPTION_ERROR("xfs_iformat(4)", XFS_CORRUPTION_ERROR("xfs_iformat(4)",
XFS_ERRLEVEL_LOW, XFS_ERRLEVEL_LOW,
...@@ -385,9 +383,8 @@ xfs_iformat( ...@@ -385,9 +383,8 @@ xfs_iformat(
di_size = be64_to_cpu(dip->di_size); di_size = be64_to_cpu(dip->di_size);
if (unlikely(di_size > XFS_DFORK_DSIZE(dip, ip->i_mount))) { if (unlikely(di_size > XFS_DFORK_DSIZE(dip, ip->i_mount))) {
xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, xfs_warn(ip->i_mount,
"corrupt inode %Lu " "corrupt inode %Lu (bad size %Ld for local inode).",
"(bad size %Ld for local inode).",
(unsigned long long) ip->i_ino, (unsigned long long) ip->i_ino,
(long long) di_size); (long long) di_size);
XFS_CORRUPTION_ERROR("xfs_iformat(5)", XFS_CORRUPTION_ERROR("xfs_iformat(5)",
...@@ -431,9 +428,8 @@ xfs_iformat( ...@@ -431,9 +428,8 @@ xfs_iformat(
size = be16_to_cpu(atp->hdr.totsize); size = be16_to_cpu(atp->hdr.totsize);
if (unlikely(size < sizeof(struct xfs_attr_sf_hdr))) { if (unlikely(size < sizeof(struct xfs_attr_sf_hdr))) {
xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, xfs_warn(ip->i_mount,
"corrupt inode %Lu " "corrupt inode %Lu (bad attr fork size %Ld).",
"(bad attr fork size %Ld).",
(unsigned long long) ip->i_ino, (unsigned long long) ip->i_ino,
(long long) size); (long long) size);
XFS_CORRUPTION_ERROR("xfs_iformat(8)", XFS_CORRUPTION_ERROR("xfs_iformat(8)",
...@@ -488,9 +484,8 @@ xfs_iformat_local( ...@@ -488,9 +484,8 @@ xfs_iformat_local(
* kmem_alloc() or memcpy() below. * kmem_alloc() or memcpy() below.
*/ */
if (unlikely(size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) { if (unlikely(size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) {
xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, xfs_warn(ip->i_mount,
"corrupt inode %Lu " "corrupt inode %Lu (bad size %d for local fork, size = %d).",
"(bad size %d for local fork, size = %d).",
(unsigned long long) ip->i_ino, size, (unsigned long long) ip->i_ino, size,
XFS_DFORK_SIZE(dip, ip->i_mount, whichfork)); XFS_DFORK_SIZE(dip, ip->i_mount, whichfork));
XFS_CORRUPTION_ERROR("xfs_iformat_local", XFS_ERRLEVEL_LOW, XFS_CORRUPTION_ERROR("xfs_iformat_local", XFS_ERRLEVEL_LOW,
...@@ -547,8 +542,7 @@ xfs_iformat_extents( ...@@ -547,8 +542,7 @@ xfs_iformat_extents(
* kmem_alloc() or memcpy() below. * kmem_alloc() or memcpy() below.
*/ */
if (unlikely(size < 0 || size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) { if (unlikely(size < 0 || size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) {
xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, xfs_warn(ip->i_mount, "corrupt inode %Lu ((a)extents = %d).",
"corrupt inode %Lu ((a)extents = %d).",
(unsigned long long) ip->i_ino, nex); (unsigned long long) ip->i_ino, nex);
XFS_CORRUPTION_ERROR("xfs_iformat_extents(1)", XFS_ERRLEVEL_LOW, XFS_CORRUPTION_ERROR("xfs_iformat_extents(1)", XFS_ERRLEVEL_LOW,
ip->i_mount, dip); ip->i_mount, dip);
...@@ -623,11 +617,10 @@ xfs_iformat_btree( ...@@ -623,11 +617,10 @@ xfs_iformat_btree(
|| XFS_BMDR_SPACE_CALC(nrecs) > || XFS_BMDR_SPACE_CALC(nrecs) >
XFS_DFORK_SIZE(dip, ip->i_mount, whichfork) XFS_DFORK_SIZE(dip, ip->i_mount, whichfork)
|| XFS_IFORK_NEXTENTS(ip, whichfork) > ip->i_d.di_nblocks)) { || XFS_IFORK_NEXTENTS(ip, whichfork) > ip->i_d.di_nblocks)) {
xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, xfs_warn(ip->i_mount, "corrupt inode %Lu (btree).",
"corrupt inode %Lu (btree).",
(unsigned long long) ip->i_ino); (unsigned long long) ip->i_ino);
XFS_ERROR_REPORT("xfs_iformat_btree", XFS_ERRLEVEL_LOW, XFS_CORRUPTION_ERROR("xfs_iformat_btree", XFS_ERRLEVEL_LOW,
ip->i_mount); ip->i_mount, dip);
return XFS_ERROR(EFSCORRUPTED); return XFS_ERROR(EFSCORRUPTED);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment