This is a note to let you know that I've just added the patch titled xfs: replace -EIO with -EFSCORRUPTED for corrupt metadata to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: xfs-replace-eio-with-efscorrupted-for-corrupt-metadata.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Wed Sep 21 10:59:34 AM CEST 2022 From: Chandan Babu R <chandan.babu@xxxxxxxxxx> Date: Wed, 21 Sep 2022 08:53:38 +0530 Subject: xfs: replace -EIO with -EFSCORRUPTED for corrupt metadata To: gregkh@xxxxxxxxxxxxxxxxxxx Cc: sashal@xxxxxxxxxx, mcgrof@xxxxxxxxxx, linux-xfs@xxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx, djwong@xxxxxxxxxx, chandan.babu@xxxxxxxxxx, amir73il@xxxxxxxxx, leah.rumancik@xxxxxxxxx Message-ID: <20220921032352.307699-4-chandan.babu@xxxxxxxxxx> From: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx> 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@xxxxxxxxxx> Reviewed-by: Christoph Hellwig <hch@xxxxxx> Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx> Acked-by: Darrick J. Wong <djwong@xxxxxxxxxx> Signed-off-by: Chandan Babu R <chandan.babu@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/xfs/libxfs/xfs_bmap.c | 6 +++--- fs/xfs/xfs_attr_inactive.c | 6 +++--- fs/xfs/xfs_dquot.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -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; } --- a/fs/xfs/xfs_attr_inactive.c +++ b/fs/xfs/xfs_attr_inactive.c @@ -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; } --- a/fs/xfs/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c @@ -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 */ Patches currently in stable-queue which might be from chandan.babu@xxxxxxxxxx are queue-5.4/xfs-refactor-agfl-length-computation-function.patch queue-5.4/xfs-use-bitops-interface-for-buf-log-item-ail-flag-check.patch queue-5.4/maintainers-add-chandan-as-xfs-maintainer-for-5.4.y.patch queue-5.4/xfs-split-the-sunit-parameter-update-into-two-parts.patch queue-5.4/xfs-slightly-tweak-an-assert-in-xfs_fs_map_blocks.patch queue-5.4/xfs-stabilize-insert-range-start-boundary-to-avoid-cow-writeback-race.patch queue-5.4/iomap-iomap-that-extends-beyond-eof-should-be-marked-dirty.patch queue-5.4/xfs-constify-the-buffer-pointer-arguments-to-error-functions.patch queue-5.4/xfs-attach-dquots-and-reserve-quota-blocks-during-unwritten-conversion.patch queue-5.4/xfs-range-check-ri_cnt-when-recovering-log-items.patch queue-5.4/xfs-fix-deadlock-between-agi-and-agf-when-target_ip-exists-in-xfs_rename.patch queue-5.4/xfs-replace-eio-with-efscorrupted-for-corrupt-metadata.patch queue-5.4/xfs-convert-eio-to-efscorrupted-when-log-contents-are-invalid.patch queue-5.4/xfs-add-missing-assert-in-xfs_fsmap_owner_from_rmap.patch queue-5.4/xfs-always-log-corruption-errors.patch queue-5.4/xfs-fix-some-memory-leaks-in-log-recovery.patch queue-5.4/xfs-don-t-commit-sunit-swidth-updates-to-disk-if-that-would-cause-repair-failures.patch