[Top] [All Lists]

[PATCH, RFC] - set b_error from bio error in xfs_buf_bio_end_io

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH, RFC] - set b_error from bio error in xfs_buf_bio_end_io
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Thu, 04 Dec 2008 21:49:21 -0600
User-agent: Thunderbird (Macintosh/20081105)
Tim mentioned something about the code in xfs_buf_iodone_work()
which detects barrier failures post-mount, as added in commit
[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?


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;

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