diff options
author | Dave Chinner <dchinner@redhat.com> | 2013-03-12 12:30:34 (GMT) |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-03-14 20:56:53 (GMT) |
commit | c163f9a1760229a95d04e37b332de7d5c1c225cd (patch) | |
tree | 26c2b888cfffa443cd27361b588aa325f4e107bb /fs/xfs | |
parent | d8ddfe81c7e4fe41b8ec342cc288d58aecdf7c47 (diff) | |
download | linux-c163f9a1760229a95d04e37b332de7d5c1c225cd.tar.xz |
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>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_buf.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 50eb603..82b70bd 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1336,6 +1336,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; |