From: Dave Chinner<dchinner@xxxxxxxxxx>
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@xxxxxxxxxx>
---

If the previous user of the buffer got an error, it is not
guaranteed to be cleared because the buffer is not re-initialised.
i.e. it's an uncached buffer that we control completely and reuse
from IO to IO with just a reset of the bno and length. If b_error is
non zero here, then the IO can fail because nothing else clears the
error in the dispatch path....
Cheers,
Dave.

Thank-you for the explanation.

FYI: I am having problems with the patches applying. This patch
complained at hunk at offset 623. Maybe I am using too new of kernel source.