public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH, RFC] - set b_error from bio error in xfs_buf_bio_end_io
@ 2008-12-05  3:49 Eric Sandeen
  2008-12-05  3:59 ` Eric Sandeen
  2008-12-05  4:06 ` Lachlan McIlroy
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Sandeen @ 2008-12-05  3:49 UTC (permalink / raw)
  To: xfs-oss

Tim mentioned something about the code in xfs_buf_iodone_work()
which detects barrier failures post-mount, as added in commit
0bfefc46dc028df60120acdb92062169c9328769,
[XFS] Barriers need to be dynamically checked and switched off

        if ((bp->b_error == EOPNOTSUPP) &&
            (bp->b_flags & (XBF_ORDERED|XBF_ASYNC)) == (XBF_ORDERED|XBF_ASYNC)) {
                XB_TRACE(bp, "ordered_retry", bp->b_iodone);
                bp->b_flags &= ~XBF_ORDERED;
                bp->b_flags |= _XFS_BARRIER_FAILED;
...

but it seems that nothing ever sets EOPNOTSUPP on b_error, so
this path would never be hit.

I think that we need to do something like below, totally untested,
to ensure that bio errors get set on b_error, if we're looking
for them by name, no?

(I'm not sure if we still need the BIO_UPTODATE test, or if
we can just look at the error we're given and be done?)

Does this seem about right?

Thanks,
-Eric

Index: linux-2.6/fs/xfs/linux-2.6/xfs_buf.c
===================================================================
--- linux-2.6.orig/fs/xfs/linux-2.6/xfs_buf.c
+++ linux-2.6/fs/xfs/linux-2.6/xfs_buf.c
@@ -1114,8 +1114,10 @@ xfs_buf_bio_end_io(
 	unsigned int		blocksize = bp->b_target->bt_bsize;
 	struct bio_vec		*bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
 
-	if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
-		bp->b_error = EIO;
+	if (error)
+		bp->b_error = XFS_ERROR(-error);
+	else if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
+		bp->b_error = XFS_ERROR(EIO);
 
 	do {
 		struct page	*page = bvec->bv_page;


_______________________________________________
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, RFC] - set b_error from bio error in xfs_buf_bio_end_io
  2008-12-05  3:49 [PATCH, RFC] - set b_error from bio error in xfs_buf_bio_end_io Eric Sandeen
@ 2008-12-05  3:59 ` Eric Sandeen
  2008-12-05  4:06 ` Lachlan McIlroy
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Sandeen @ 2008-12-05  3:59 UTC (permalink / raw)
  To: xfs-oss

Eric Sandeen wrote:
> Tim mentioned something about the code in xfs_buf_iodone_work()
> which detects barrier failures post-mount, as added in commit
> 0bfefc46dc028df60120acdb92062169c9328769,
> [XFS] Barriers need to be dynamically checked and switched off
> 
>         if ((bp->b_error == EOPNOTSUPP) &&
>             (bp->b_flags & (XBF_ORDERED|XBF_ASYNC)) == (XBF_ORDERED|XBF_ASYNC)) {
>                 XB_TRACE(bp, "ordered_retry", bp->b_iodone);
>                 bp->b_flags &= ~XBF_ORDERED;
>                 bp->b_flags |= _XFS_BARRIER_FAILED;
> ...
> 
> but it seems that nothing ever sets EOPNOTSUPP on b_error, so
> this path would never be hit.
> 
> I think that we need to do something like below, totally untested,
> to ensure that bio errors get set on b_error, if we're looking
> for them by name, no?

oh, heh, Tim had mentioned that Lachlan suggested this same thing on irc
yesterday, but somehow I had forgotten or totally missed that... didn't
mean to usurp Lachlan :)

-Eric

_______________________________________________
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, RFC] - set b_error from bio error in xfs_buf_bio_end_io
  2008-12-05  3:49 [PATCH, RFC] - set b_error from bio error in xfs_buf_bio_end_io Eric Sandeen
  2008-12-05  3:59 ` Eric Sandeen
@ 2008-12-05  4:06 ` Lachlan McIlroy
  2008-12-05  4:09   ` Eric Sandeen
  1 sibling, 1 reply; 4+ messages in thread
From: Lachlan McIlroy @ 2008-12-05  4:06 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

Eric Sandeen wrote:
> Tim mentioned something about the code in xfs_buf_iodone_work()
> which detects barrier failures post-mount, as added in commit
> 0bfefc46dc028df60120acdb92062169c9328769,
> [XFS] Barriers need to be dynamically checked and switched off
> 
>         if ((bp->b_error == EOPNOTSUPP) &&
>             (bp->b_flags & (XBF_ORDERED|XBF_ASYNC)) == (XBF_ORDERED|XBF_ASYNC)) {
>                 XB_TRACE(bp, "ordered_retry", bp->b_iodone);
>                 bp->b_flags &= ~XBF_ORDERED;
>                 bp->b_flags |= _XFS_BARRIER_FAILED;
> ...
> 
> but it seems that nothing ever sets EOPNOTSUPP on b_error, so
> this path would never be hit.
> 
> I think that we need to do something like below, totally untested,
> to ensure that bio errors get set on b_error, if we're looking
> for them by name, no?
> 
> (I'm not sure if we still need the BIO_UPTODATE test, or if
> we can just look at the error we're given and be done?)
> 
> Does this seem about right?
> 
> Thanks,
> -Eric
> 
> Index: linux-2.6/fs/xfs/linux-2.6/xfs_buf.c
> ===================================================================
> --- linux-2.6.orig/fs/xfs/linux-2.6/xfs_buf.c
> +++ linux-2.6/fs/xfs/linux-2.6/xfs_buf.c
> @@ -1114,8 +1114,10 @@ xfs_buf_bio_end_io(
>  	unsigned int		blocksize = bp->b_target->bt_bsize;
>  	struct bio_vec		*bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
>  
> -	if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
> -		bp->b_error = EIO;
> +	if (error)
> +		bp->b_error = XFS_ERROR(-error);
> +	else if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
> +		bp->b_error = XFS_ERROR(EIO);


I would suggest this:

@@ -1114,8 +1140,7 @@ xfs_buf_bio_end_io(
  	unsigned int		blocksize = bp->b_target->bt_bsize;
  	struct bio_vec		*bvec = bio->bi_io_vec + bio->bi_vcnt - 1;

-	if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
-		bp->b_error = EIO;
+	xfs_buf_ioerror(bp, -error);

  	do {
  		struct page	*page = bvec->bv_page;

The BIO_UPTODATE checks have already been done before calling this function
and error has been set appropriately so we can just use it.

>  
>  	do {
>  		struct page	*page = bvec->bv_page;
> 
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
> 

_______________________________________________
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, RFC] - set b_error from bio error in xfs_buf_bio_end_io
  2008-12-05  4:06 ` Lachlan McIlroy
@ 2008-12-05  4:09   ` Eric Sandeen
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Sandeen @ 2008-12-05  4:09 UTC (permalink / raw)
  To: lachlan; +Cc: xfs-oss

Lachlan McIlroy wrote:

> I would suggest this:
> 
> @@ -1114,8 +1140,7 @@ xfs_buf_bio_end_io(
>   	unsigned int		blocksize = bp->b_target->bt_bsize;
>   	struct bio_vec		*bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
> 
> -	if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
> -		bp->b_error = EIO;
> +	xfs_buf_ioerror(bp, -error);

oh, sure.  I forgot we had the wrapper to set the error ... :)

> The BIO_UPTODATE checks have already been done before calling this function
> and error has been set appropriately so we can just use it.

ah so it is.   yeah, makes perfect sense.

-Eric

_______________________________________________
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:[~2008-12-05  4:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-05  3:49 [PATCH, RFC] - set b_error from bio error in xfs_buf_bio_end_io Eric Sandeen
2008-12-05  3:59 ` Eric Sandeen
2008-12-05  4:06 ` Lachlan McIlroy
2008-12-05  4:09   ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox