Re: Mount ext3 with barrier=1 doesn't send real barrier bio?

From: Jens Axboe
Date: Fri Aug 22 2008 - 02:38:38 EST


On Fri, Aug 22 2008, OGAWA Hirofumi wrote:
> Eric Sandeen <sandeen@xxxxxxxxxxx> writes:
>
> >> --- a/fs/buffer.c
> >> +++ b/fs/buffer.c
> >> @@ -2926,16 +2926,16 @@ int submit_bh(int rw, struct buffer_head * bh)
> >> BUG_ON(!buffer_mapped(bh));
> >> BUG_ON(!bh->b_end_io);
> >>
> >> - if (buffer_ordered(bh) && (rw == WRITE))
> >> - rw = WRITE_BARRIER;
> >> -
> >> /*
> >> * Only clear out a write error when rewriting, should this
> >> * include WRITE_SYNC as well?
> >> */
> >> - if (test_set_buffer_req(bh) && (rw == WRITE || rw == WRITE_BARRIER))
> >> + if (test_set_buffer_req(bh) && rw == WRITE)
> >> clear_buffer_write_io_error(bh);
>
> This should be ((rw & RW_MASK) == WRITE) too? Anyway, this seems change
> behavior of submit_bh(WRITE_BARRIER) (maybe reiserfs only), it wouldn't
> be your intent...

Yes, I believe the simpler and more correct fix is:

diff --git a/fs/buffer.c b/fs/buffer.c
index 38653e3..16b2263 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2926,14 +2926,13 @@ int submit_bh(int rw, struct buffer_head * bh)
BUG_ON(!buffer_mapped(bh));
BUG_ON(!bh->b_end_io);

- if (buffer_ordered(bh) && (rw == WRITE))
+ if (buffer_ordered(bh) && (rw & WRITE))
rw = WRITE_BARRIER;

/*
- * Only clear out a write error when rewriting, should this
- * include WRITE_SYNC as well?
+ * Only clear out a write error when rewriting
*/
- if (test_set_buffer_req(bh) && (rw == WRITE || rw == WRITE_BARRIER))
+ if (test_set_buffer_req(bh) && (rw & WRITE))
clear_buffer_write_io_error(bh);

/*

--
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/