提交 ac75a1f7 编写于 作者: D Dave Chinner 提交者: Dave Chinner

xfs: don't leak EFSBADCRC to userspace

While the verifier routines may return EFSBADCRC when a buffer has
a bad CRC, we need to translate that to EFSCORRUPTED so that the
higher layers treat the error appropriately and we return a
consistent error to userspace. This fixes a xfs/005 regression.
Signed-off-by: NDave Chinner <dchinner@redhat.com>
Reviewed-by: NBrian Foster <bfoster@redhat.com>
Signed-off-by: NDave Chinner <david@fromorbit.com>
上级 38dbfb59
...@@ -307,6 +307,9 @@ xfs_readsb( ...@@ -307,6 +307,9 @@ xfs_readsb(
error = bp->b_error; error = bp->b_error;
if (loud) if (loud)
xfs_warn(mp, "SB validate failed with error %d.", error); xfs_warn(mp, "SB validate failed with error %d.", error);
/* bad CRC means corrupted metadata */
if (error == EFSBADCRC)
error = EFSCORRUPTED;
goto release_buf; goto release_buf;
} }
......
...@@ -80,6 +80,10 @@ xfs_readlink_bmap( ...@@ -80,6 +80,10 @@ xfs_readlink_bmap(
if (error) { if (error) {
xfs_buf_ioerror_alert(bp, __func__); xfs_buf_ioerror_alert(bp, __func__);
xfs_buf_relse(bp); xfs_buf_relse(bp);
/* bad CRC means corrupted metadata */
if (error == EFSBADCRC)
error = EFSCORRUPTED;
goto out; goto out;
} }
byte_cnt = XFS_SYMLINK_BUF_SPACE(mp, byte_cnt); byte_cnt = XFS_SYMLINK_BUF_SPACE(mp, byte_cnt);
......
...@@ -275,6 +275,10 @@ xfs_trans_read_buf_map( ...@@ -275,6 +275,10 @@ xfs_trans_read_buf_map(
XFS_BUF_UNDONE(bp); XFS_BUF_UNDONE(bp);
xfs_buf_stale(bp); xfs_buf_stale(bp);
xfs_buf_relse(bp); xfs_buf_relse(bp);
/* bad CRC means corrupted metadata */
if (error == EFSBADCRC)
error = EFSCORRUPTED;
return error; return error;
} }
#ifdef DEBUG #ifdef DEBUG
...@@ -338,6 +342,9 @@ xfs_trans_read_buf_map( ...@@ -338,6 +342,9 @@ xfs_trans_read_buf_map(
if (tp->t_flags & XFS_TRANS_DIRTY) if (tp->t_flags & XFS_TRANS_DIRTY)
xfs_force_shutdown(tp->t_mountp, xfs_force_shutdown(tp->t_mountp,
SHUTDOWN_META_IO_ERROR); SHUTDOWN_META_IO_ERROR);
/* bad CRC means corrupted metadata */
if (error == EFSBADCRC)
error = EFSCORRUPTED;
return error; return error;
} }
} }
...@@ -375,6 +382,10 @@ xfs_trans_read_buf_map( ...@@ -375,6 +382,10 @@ xfs_trans_read_buf_map(
if (tp->t_flags & XFS_TRANS_DIRTY) if (tp->t_flags & XFS_TRANS_DIRTY)
xfs_force_shutdown(tp->t_mountp, SHUTDOWN_META_IO_ERROR); xfs_force_shutdown(tp->t_mountp, SHUTDOWN_META_IO_ERROR);
xfs_buf_relse(bp); xfs_buf_relse(bp);
/* bad CRC means corrupted metadata */
if (error == EFSBADCRC)
error = EFSCORRUPTED;
return error; return error;
} }
#ifdef DEBUG #ifdef DEBUG
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册