summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2013-03-12 23:30:34 +1100
committerBen Myers <bpm@sgi.com>2013-03-18 13:39:10 -0500
commite001873853d87674dd5b3cfa2851885023616695 (patch)
tree5a88db119babf206d0822aab6e5b70cc1c975fba
parent3325beed46d8d14d873e94d89ea57ee900dec942 (diff)
downloadop-kernel-dev-e001873853d87674dd5b3cfa2851885023616695.zip
op-kernel-dev-e001873853d87674dd5b3cfa2851885023616695.tar.gz
xfs: ensure we capture IO errors correctly
Failed buffer readahead can leave the buffer in the cache marked with an error. Most callers that then issue a subsequent read on the buffer do not zero the b_error field out, and so we may incorectly detect an error during IO completion due to the stale error value left on the buffer. Avoid this problem by zeroing the error before IO submission. This ensures that the only IO errors that are detected those captured from are those captured from bio submission or completion. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com> (cherry picked from commit c163f9a1760229a95d04e37b332de7d5c1c225cd)
-rw-r--r--fs/xfs/xfs_buf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 4e8f0df..8459b5d 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -1334,6 +1334,12 @@ _xfs_buf_ioapply(
int size;
int i;
+ /*
+ * Make sure we capture only current IO errors rather than stale errors
+ * left over from previous use of the buffer (e.g. failed readahead).
+ */
+ bp->b_error = 0;
+
if (bp->b_flags & XBF_WRITE) {
if (bp->b_flags & XBF_SYNCIO)
rw = WRITE_SYNC;
OpenPOWER on IntegriCloud