Skip to contentSkip to conversation

xfs: ensure we capture IO errors correctly

PATCH In review Dave Chinner 3 participants 4 messages Mar 8, 2013 – Mar 11, 2013 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: ensure we capture IO errors correctly

From: Dave Chinner <[email protected]>

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.

---
 fs/xfs/xfs_buf.c |    6 ++++++
 1 file changed, 6 insertions(+)
fs/xfs/xfs_buf.c +6 -0
index 50eb603..82b70bd 100644
@@ -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;
Signature · 6 lines
1.7.10.4

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#1 lore raw

Hi,

this sounds like stable material after a little simmering..

Cheers,
Pete

Am Freitag, 8. März 2013, 13:01:14 schrieb Dave Chinner:

Quoted 24 lines

From: Dave Chinner <[email protected]>

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.

---
 fs/xfs/xfs_buf.c |    6 ++++++
 1 file changed, 6 insertions(+)
fs/xfs/xfs_buf.c +0 -0
index 50eb603..82b70bd 100644
@@ -1336,6 +1336,12 @@ _xfs_buf_ioapply(
 	int		size;
 	int		i;

fs/xfs/xfs_buf.c _xfs_buf_ioapply( · line 1347

Quoted 10 lines
fs/xfs/xfs_buf.c +6 -0
 
+	/*
+	 * 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;

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw
Quoted 3 lines · Hans-Peter Jansen

Hi,

this sounds like stable material after a little simmering..

Yes, it probably is a candidate for 3.8.x

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v1 1/1
#3 lore raw
In reply to Dave Chinner
Quoted 8 lines · Dave Chinner

From: Dave Chinner<[email protected]>

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.

Quoted 6 lines

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.

---

Looks good.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs