Re: [PATCH 1/8] xfs: check for buffer errors before waiting

Mark Tinguely
2012-03-29T19:04:14Z

On 03/29/12 07:23, Dave Chinner wrote:
> From: Dave Chinner<dchinner@redhat.com>
>
> If we call xfs_buf_iowait() on a buffer that failed dispatch due to
> an IO error, it will wait forever for an Io that does not exist.
> This is hndled in xfs_buf_read, but there is other code that calls
> xfs_buf_iowait directly that doesn't.
>
> Rather than make the call sites have to handle checking for dispatch
> errors and then checking for completion errors, make
> xfs_buf_iowait() check for dispatch errors on the buffer before
> waiting. This means we handle both dispatch and completion errors
> with one set of error handling at the caller sites.
>
> Signed-off-by: Dave Chinner<dchinner@redhat.com>
> ---

> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index 396e3bf..64ed6ff 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -179,6 +179,7 @@ xlog_bread_noalign(
> XFS_BUF_SET_ADDR(bp, log->l_logBBstart + blk_no);
> XFS_BUF_READ(bp);
> XFS_BUF_SET_COUNT(bp, BBTOB(nbblks));
> + bp->b_error = 0;
>
> xfsbdstrat(log->l_mp, bp);
> error = xfs_buf_iowait(bp);
> @@ -266,6 +267,7 @@ xlog_bwrite(
> xfs_buf_hold(bp);
> xfs_buf_lock(bp);
> XFS_BUF_SET_COUNT(bp, BBTOB(nbblks));
> + bp->b_error = 0;
>
> error = xfs_bwrite(bp);
> if (error)

Just curious, were these needed for a particular reason?

Looks good.

Reviewed-by: Mark Tinguely <tinguely@sgi.com>