Re: [PATCH 10/19] xfs: verify dquot blocks as they are read from disk

Christoph Hellwig
2012-10-11T21:46:33Z

On Tue, Oct 09, 2012 at 02:51:01PM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> Add a dquot buffer verify callback function and pass it into the
> buffer read functions. This checks all the dquots in a buffer, but
> cannot completely verify the dquot ids are correct. Also, errors
> cannot be repaired, so an additional function is added to repair bad
> dquots in the buffer if such an error is detected in a context where
> repair is allowed.
>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

But after the first half dozen of callback I have a question:

> + if (error) {
> + XFS_CORRUPTION_ERROR("xfs_dquot_read_verify",
> + XFS_ERRLEVEL_LOW, mp, d);
> + xfs_buf_ioerror(bp, EFSCORRUPTED);
> + break;
> + }
> + }
> + bp->b_iodone = NULL;
> + xfs_buf_ioend(bp, 0);

It seems we always call xfs_buf_ioerror on errors, and then always
do a

bp->b_iodone = NULL;
xfs_buf_ioend(bp, 0);

for each callback. What is the reason we can't take these two into the
core buffer cache code?