Commit 8314bca0 authored by Chandan Babu R's avatar Chandan Babu R

xfs: Replace numbered inode recovery error messages with descriptive ones

This commit also prints inode fields with invalid values instead of printing
addresses of inode and buffer instances.
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarChandan Babu R <chandan.babu@oracle.com>
Suggested-by: default avatarDave Chinner <dchinner@redhat.com>
parent df9ad5cc
...@@ -324,13 +324,12 @@ xlog_recover_inode_commit_pass2( ...@@ -324,13 +324,12 @@ xlog_recover_inode_commit_pass2(
if (unlikely(S_ISREG(ldip->di_mode))) { if (unlikely(S_ISREG(ldip->di_mode))) {
if ((ldip->di_format != XFS_DINODE_FMT_EXTENTS) && if ((ldip->di_format != XFS_DINODE_FMT_EXTENTS) &&
(ldip->di_format != XFS_DINODE_FMT_BTREE)) { (ldip->di_format != XFS_DINODE_FMT_BTREE)) {
XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(3)", XFS_CORRUPTION_ERROR(
XFS_ERRLEVEL_LOW, mp, ldip, "Bad log dinode data fork format for regular file",
sizeof(*ldip)); XFS_ERRLEVEL_LOW, mp, ldip, sizeof(*ldip));
xfs_alert(mp, xfs_alert(mp,
"%s: Bad regular inode log record, rec ptr "PTR_FMT", " "Bad inode 0x%llx, data fork format 0x%x",
"ino ptr = "PTR_FMT", ino bp = "PTR_FMT", ino %Ld", in_f->ilf_ino, ldip->di_format);
__func__, item, dip, bp, in_f->ilf_ino);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_release; goto out_release;
} }
...@@ -338,49 +337,42 @@ xlog_recover_inode_commit_pass2( ...@@ -338,49 +337,42 @@ xlog_recover_inode_commit_pass2(
if ((ldip->di_format != XFS_DINODE_FMT_EXTENTS) && if ((ldip->di_format != XFS_DINODE_FMT_EXTENTS) &&
(ldip->di_format != XFS_DINODE_FMT_BTREE) && (ldip->di_format != XFS_DINODE_FMT_BTREE) &&
(ldip->di_format != XFS_DINODE_FMT_LOCAL)) { (ldip->di_format != XFS_DINODE_FMT_LOCAL)) {
XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(4)", XFS_CORRUPTION_ERROR(
XFS_ERRLEVEL_LOW, mp, ldip, "Bad log dinode data fork format for directory",
sizeof(*ldip)); XFS_ERRLEVEL_LOW, mp, ldip, sizeof(*ldip));
xfs_alert(mp, xfs_alert(mp,
"%s: Bad dir inode log record, rec ptr "PTR_FMT", " "Bad inode 0x%llx, data fork format 0x%x",
"ino ptr = "PTR_FMT", ino bp = "PTR_FMT", ino %Ld", in_f->ilf_ino, ldip->di_format);
__func__, item, dip, bp, in_f->ilf_ino);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_release; goto out_release;
} }
} }
if (unlikely(ldip->di_nextents + ldip->di_anextents > ldip->di_nblocks)){ if (unlikely(ldip->di_nextents + ldip->di_anextents > ldip->di_nblocks)){
XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(5)", XFS_CORRUPTION_ERROR("Bad log dinode extent counts",
XFS_ERRLEVEL_LOW, mp, ldip, XFS_ERRLEVEL_LOW, mp, ldip, sizeof(*ldip));
sizeof(*ldip));
xfs_alert(mp, xfs_alert(mp,
"%s: Bad inode log record, rec ptr "PTR_FMT", dino ptr "PTR_FMT", " "Bad inode 0x%llx, nextents 0x%x, anextents 0x%x, nblocks 0x%llx",
"dino bp "PTR_FMT", ino %Ld, total extents = %d, nblocks = %Ld", in_f->ilf_ino, ldip->di_nextents, ldip->di_anextents,
__func__, item, dip, bp, in_f->ilf_ino,
ldip->di_nextents + ldip->di_anextents,
ldip->di_nblocks); ldip->di_nblocks);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_release; goto out_release;
} }
if (unlikely(ldip->di_forkoff > mp->m_sb.sb_inodesize)) { if (unlikely(ldip->di_forkoff > mp->m_sb.sb_inodesize)) {
XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(6)", XFS_CORRUPTION_ERROR("Bad log dinode fork offset",
XFS_ERRLEVEL_LOW, mp, ldip, XFS_ERRLEVEL_LOW, mp, ldip, sizeof(*ldip));
sizeof(*ldip));
xfs_alert(mp, xfs_alert(mp,
"%s: Bad inode log record, rec ptr "PTR_FMT", dino ptr "PTR_FMT", " "Bad inode 0x%llx, di_forkoff 0x%x",
"dino bp "PTR_FMT", ino %Ld, forkoff 0x%x", __func__, in_f->ilf_ino, ldip->di_forkoff);
item, dip, bp, in_f->ilf_ino, ldip->di_forkoff);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_release; goto out_release;
} }
isize = xfs_log_dinode_size(mp); isize = xfs_log_dinode_size(mp);
if (unlikely(item->ri_buf[1].i_len > isize)) { if (unlikely(item->ri_buf[1].i_len > isize)) {
XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(7)", XFS_CORRUPTION_ERROR("Bad log dinode size", XFS_ERRLEVEL_LOW,
XFS_ERRLEVEL_LOW, mp, ldip, mp, ldip, sizeof(*ldip));
sizeof(*ldip));
xfs_alert(mp, xfs_alert(mp,
"%s: Bad inode log record length %d, rec ptr "PTR_FMT, "Bad inode 0x%llx log dinode size 0x%x",
__func__, item->ri_buf[1].i_len, item); in_f->ilf_ino, item->ri_buf[1].i_len);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
goto out_release; goto out_release;
} }
......
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