On Fri, Aug 15, 2014 at 09:18:37AM -0400, Brian Foster wrote:
> On Fri, Aug 15, 2014 at 04:39:01PM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@xxxxxxxxxx>
> > Currently the report of a bio error from completion
> > immediately marks the buffer with an error. The issue is that this
> > is racy w.r.t. synchronous IO - the submitter can see b_error being
> > set before the IO is complete, and hence we cannot differentiate
> > between submission failures and completion failures.
> > Add an internal b_io_error field protected by the b_lock to catch IO
> > completion errors, and only propagate that to the buffer during
> > final IO completion handling. Hence we can tell in xfs_buf_iorequest
> > if we've had a submission failure bey checking bp->b_error before
> > dropping our b_io_remaining reference - that reference will prevent
> > b_io_error values from being propagated to b_error in the event that
> > completion races with submission.
> > In doing so, allow xfs_buf_iorequest to return an error. That way,
> > the caller can check for submission errors safely if required, and
> > easily distinguish them from completion errors that come from
> > xfs_buf_iowait().
> I don't see any changes to xfs_buf_iorequest() at all in this one. That
> aside, it looks fine. It's not how I was thinking about it, but a clear
> separation of submission error regardless.
Apart from adding a zeroing of b_io_error, no, it doesn't change.
What I meant to describe was the new capability this adds. I'll
rewrite the paragraph to say:
In doing so, xfs_buf_iorequest now has the capability to
distinguish between submission and completion errors, and hence if
we need to we can return submission errors directly and allow
callers to gather completion errors from xfs_buf_iowait().