xfs
[Top] [All Lists]

Re: [PATCH] xfs: ensure we capture IO errors correctly

To: xfs@xxxxxxxxxxx
Subject: Re: [PATCH] xfs: ensure we capture IO errors correctly
From: Hans-Peter Jansen <hpj@xxxxxxxxx>
Date: Fri, 08 Mar 2013 14:06:52 +0100
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1362708074-14987-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1362708074-14987-1-git-send-email-david@xxxxxxxxxxxxx>
User-agent: KMail/4.9.5 (Linux/3.4.28-2.20-desktop; KDE/4.9.5; x86_64; ; )
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@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> ---
>  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;

<Prev in Thread] Current Thread [Next in Thread>