[6/5] xfs_repair: print better information when metadata updates fail
diff mbox series

Message ID 20191030175256.GP15222@magnolia
State Accepted
Headers show
Series
  • xfsprogs: random fixes
Related show

Commit Message

Darrick J. Wong Oct. 30, 2019, 5:52 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

If a metadata update fails during phase 6, we should print an error
message that can be traced back to a specific line of code.  Also,
res_failed spits out a general message about "xfs_trans_reserve failed",
which is probably not where the failure happened.  Fix two incorrect
call sites.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 repair/phase6.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Eric Sandeen Nov. 1, 2019, 6:42 p.m. UTC | #1
On 10/30/19 12:52 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> If a metadata update fails during phase 6, we should print an error
> message that can be traced back to a specific line of code.  Also,
> res_failed spits out a general message about "xfs_trans_reserve failed",
> which is probably not where the failure happened.  Fix two incorrect
> call sites.

looks like mkfs could use a fix too,

        c = -libxfs_trans_commit(tp);
        if (c)
                res_failed(c);

but for this,

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

not sure if we care, but:

Fixes: f9c559f4e ("xfs_repair: invalidate dirty dir buffers when we zap a  directory")
Fixes: f2279d8de ("libxfs: check libxfs_trans_commit return values")

Patch
diff mbox series

diff --git a/repair/phase6.c b/repair/phase6.c
index 28e633de..91d208a6 100644
--- a/repair/phase6.c
+++ b/repair/phase6.c
@@ -1354,7 +1354,8 @@  longform_dir2_rebuild(
 
 	error = dir_binval(tp, ip, XFS_DATA_FORK);
 	if (error)
-		res_failed(error);
+		do_error(_("error %d invalidating directory %llu blocks\n"),
+				error, (unsigned long long)ip->i_ino);
 
 	if ((error = -libxfs_bmap_last_offset(ip, &lastblock, XFS_DATA_FORK)))
 		do_error(_("xfs_bmap_last_offset failed -- error - %d\n"),
@@ -2972,7 +2973,10 @@  process_dir_inode(
 					XFS_ILOG_CORE | XFS_ILOG_DDATA);
 				error = -libxfs_trans_commit(tp);
 				if (error)
-					res_failed(error);
+					do_error(
+_("error %d fixing shortform directory %llu\n"),
+						error,
+						(unsigned long long)ip->i_ino);
 			} else  {
 				libxfs_trans_cancel(tp);
 			}