On Mon, Mar 03, 2014 at 04:39:53PM +1100, Dave Chinner wrote: > From: Dave Chinner <dchinner@xxxxxxxxxx> > > While the verifier reoutines may return EFSBADCRC when a buffer ahs > a bad CRC, we need to translate that to EFSCORRUPTED so that the > higher layers treat the error appropriately and so we return a > consistent error to userspace. This fixes a xfs/005 regression. > > Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx> > --- This change looks Ok to me, but when I start looking through the users of bp->b_error, I see examples like xfs_dir3_data_read() being called in xfs_dir2_leaf_addname() where it looks like an error could bubble all the way up to xfs_vn_mknod() and its callers. If the intent is to use EFSBADCRC as an internal-only error to differentiate corruption from crc failure, why not push this more closely to the boundaries that we have already defined? For example, we already convert positive errnos to negative at the internal/external boundaries. Could we convert those to use some kind of XFS_USERSPACE_ERROR(error) macro/helper that converts errors appropriately? Another thought could be to reconsider whether we still need some of these extra warnings, as in the xfs_mount.c hunk below, now that we have the generic xfs_verifier_error() messaging. E.g., if we could remove those, perhaps we could snub out EFSBADCRC in or around the verifier after it makes a distinction. Brian > fs/xfs/xfs_mount.c | 3 +++ > fs/xfs/xfs_symlink.c | 4 ++++ > fs/xfs/xfs_trans_buf.c | 11 +++++++++++ > 3 files changed, 18 insertions(+) > > diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c > index f96c056..993cb19 100644 > --- a/fs/xfs/xfs_mount.c > +++ b/fs/xfs/xfs_mount.c > @@ -314,6 +314,9 @@ reread: > error = bp->b_error; > if (loud) > xfs_warn(mp, "SB validate failed with error %d.", error); > + /* bad CRC means corrupted metadata */ > + if (error == EFSBADCRC) > + error = EFSCORRUPTED; > goto release_buf; > } > > diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c > index 14e58f2..5fda189 100644 > --- a/fs/xfs/xfs_symlink.c > +++ b/fs/xfs/xfs_symlink.c > @@ -80,6 +80,10 @@ xfs_readlink_bmap( > if (error) { > xfs_buf_ioerror_alert(bp, __func__); > xfs_buf_relse(bp); > + > + /* bad CRC means corrupted metadata */ > + if (error == EFSBADCRC) > + error = EFSCORRUPTED; > goto out; > } > byte_cnt = XFS_SYMLINK_BUF_SPACE(mp, byte_cnt); > diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c > index 647b6f1..b8eef05 100644 > --- a/fs/xfs/xfs_trans_buf.c > +++ b/fs/xfs/xfs_trans_buf.c > @@ -275,6 +275,10 @@ xfs_trans_read_buf_map( > XFS_BUF_UNDONE(bp); > xfs_buf_stale(bp); > xfs_buf_relse(bp); > + > + /* bad CRC means corrupted metadata */ > + if (error == EFSBADCRC) > + error = EFSCORRUPTED; > return error; > } > #ifdef DEBUG > @@ -338,6 +342,9 @@ xfs_trans_read_buf_map( > if (tp->t_flags & XFS_TRANS_DIRTY) > xfs_force_shutdown(tp->t_mountp, > SHUTDOWN_META_IO_ERROR); > + /* bad CRC means corrupted metadata */ > + if (error == EFSBADCRC) > + error = EFSCORRUPTED; > return error; > } > } > @@ -375,6 +382,10 @@ xfs_trans_read_buf_map( > if (tp->t_flags & XFS_TRANS_DIRTY) > xfs_force_shutdown(tp->t_mountp, SHUTDOWN_META_IO_ERROR); > xfs_buf_relse(bp); > + > + /* bad CRC means corrupted metadata */ > + if (error == EFSBADCRC) > + error = EFSCORRUPTED; > return error; > } > #ifdef DEBUG > -- > 1.9.0 > > _______________________________________________ > xfs mailing list > xfs@xxxxxxxxxxx > http://oss.sgi.com/mailman/listinfo/xfs _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs