]> git.itanic.dy.fi Git - linux-stable/commitdiff
xfs: replace -EIO with -EFSCORRUPTED for corrupt metadata
authorDarrick J. Wong <darrick.wong@oracle.com>
Sat, 24 Sep 2022 12:56:40 +0000 (18:26 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Sep 2022 09:04:09 +0000 (11:04 +0200)
commit c2414ad6e66ab96b867309454498f7fb29b7e855 upstream.

There are a few places where we return -EIO instead of -EFSCORRUPTED
when we find corrupt metadata.  Fix those places.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/libxfs/xfs_bmap.c
fs/xfs/xfs_attr_inactive.c
fs/xfs/xfs_dquot.c

index c114d24be61938ecba2336dd518ea325363883e9..de4e71725b2cb197c9c228dc519687a692a09b9b 100644 (file)
@@ -1374,7 +1374,7 @@ xfs_bmap_last_before(
        case XFS_DINODE_FMT_EXTENTS:
                break;
        default:
-               return -EIO;
+               return -EFSCORRUPTED;
        }
 
        if (!(ifp->if_flags & XFS_IFEXTENTS)) {
@@ -1475,7 +1475,7 @@ xfs_bmap_last_offset(
 
        if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE &&
            XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS)
-              return -EIO;
+               return -EFSCORRUPTED;
 
        error = xfs_bmap_last_extent(NULL, ip, whichfork, &rec, &is_empty);
        if (error || is_empty)
@@ -5872,7 +5872,7 @@ xfs_bmap_insert_extents(
                                del_cursor);
 
        if (stop_fsb >= got.br_startoff + got.br_blockcount) {
-               error = -EIO;
+               error = -EFSCORRUPTED;
                goto del_cursor;
        }
 
index a640a285cc52156a0dc1e42e72a9104bb7cdd623..f83f11d929e49969aae65c223bb0d9af439172b0 100644 (file)
@@ -209,7 +209,7 @@ xfs_attr3_node_inactive(
         */
        if (level > XFS_DA_NODE_MAXDEPTH) {
                xfs_trans_brelse(*trans, bp);   /* no locks for later trans */
-               return -EIO;
+               return -EFSCORRUPTED;
        }
 
        node = bp->b_addr;
@@ -258,7 +258,7 @@ xfs_attr3_node_inactive(
                        error = xfs_attr3_leaf_inactive(trans, dp, child_bp);
                        break;
                default:
-                       error = -EIO;
+                       error = -EFSCORRUPTED;
                        xfs_trans_brelse(*trans, child_bp);
                        break;
                }
@@ -341,7 +341,7 @@ xfs_attr3_root_inactive(
                error = xfs_attr3_leaf_inactive(trans, dp, bp);
                break;
        default:
-               error = -EIO;
+               error = -EFSCORRUPTED;
                xfs_trans_brelse(*trans, bp);
                break;
        }
index 3cbf248af51ff74588516d71e920bb5c671327c5..aa508418027037346e8a771060649576c3ba45b9 100644 (file)
@@ -1125,7 +1125,7 @@ xfs_qm_dqflush(
                xfs_buf_relse(bp);
                xfs_dqfunlock(dqp);
                xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
-               return -EIO;
+               return -EFSCORRUPTED;
        }
 
        /* This is the only portion of data that needs to persist */