All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: ensure we capture IO errors correctly
@ 2013-03-08  2:01 Dave Chinner
  2013-03-08 13:06 ` Hans-Peter Jansen
  2013-03-11 14:00 ` Mark Tinguely
  0 siblings, 2 replies; 4+ messages in thread
From: Dave Chinner @ 2013-03-08  2:01 UTC (permalink / raw)
  To: xfs

From: Dave Chinner <dchinner@redhat.com>

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>
---
 fs/xfs/xfs_buf.c |    6 ++++++
 1 file changed, 6 insertions(+)

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;
-- 
1.7.10.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: ensure we capture IO errors correctly
  2013-03-08  2:01 [PATCH] xfs: ensure we capture IO errors correctly Dave Chinner
@ 2013-03-08 13:06 ` Hans-Peter Jansen
  2013-03-11  2:00   ` Dave Chinner
  2013-03-11 14:00 ` Mark Tinguely
  1 sibling, 1 reply; 4+ messages in thread
From: Hans-Peter Jansen @ 2013-03-08 13:06 UTC (permalink / raw)
  To: xfs

Hi, 

this sounds like stable material after a little simmering..

Cheers,
Pete

Am Freitag, 8. März 2013, 13:01:14 schrieb Dave Chinner:
> From: Dave Chinner <dchinner@redhat.com>
> 
> 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>
> ---
>  fs/xfs/xfs_buf.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> 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;

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: ensure we capture IO errors correctly
  2013-03-08 13:06 ` Hans-Peter Jansen
@ 2013-03-11  2:00   ` Dave Chinner
  0 siblings, 0 replies; 4+ messages in thread
From: Dave Chinner @ 2013-03-11  2:00 UTC (permalink / raw)
  To: Hans-Peter Jansen; +Cc: xfs

On Fri, Mar 08, 2013 at 02:06:52PM +0100, Hans-Peter Jansen wrote:
> Hi, 
> 
> this sounds like stable material after a little simmering..

Yes, it probably is a candidate for 3.8.x

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: ensure we capture IO errors correctly
  2013-03-08  2:01 [PATCH] xfs: ensure we capture IO errors correctly Dave Chinner
  2013-03-08 13:06 ` Hans-Peter Jansen
@ 2013-03-11 14:00 ` Mark Tinguely
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Tinguely @ 2013-03-11 14:00 UTC (permalink / raw)
  To: Dave Chinner; +Cc: xfs

On 03/07/13 20:01, Dave Chinner wrote:
> From: Dave Chinner<dchinner@redhat.com>
>
> 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>
> ---

Looks good.

Reviewed-by: Mark Tinguely <tinguely@sgi.com>

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-11 15:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-08  2:01 [PATCH] xfs: ensure we capture IO errors correctly Dave Chinner
2013-03-08 13:06 ` Hans-Peter Jansen
2013-03-11  2:00   ` Dave Chinner
2013-03-11 14:00 ` Mark Tinguely

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.