diff options
author | NeilBrown <neilb@suse.de> | 2006-05-01 12:15:47 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-05-01 18:17:42 -0700 |
commit | 62de608da0b0ab17d81a233b50d1e952b9816f69 (patch) | |
tree | 12647d87f70cddf29edeeee2d85358667aa24cd8 /drivers | |
parent | bea2771871ed1084c9a85ed0c86340f188505702 (diff) |
[PATCH] md: Improve detection of lack of barrier support in raid1
Move the test for 'do barrier work' down a bit so that if the first write to a
raid1 is a BIO_RW_BARRIER write, the checking done by superblock writes will
cause the right thing to happen.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/raid1.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 532d04077301..b8c13c897ccb 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -753,18 +753,24 @@ static int make_request(request_queue_t *q, struct bio * bio) const int rw = bio_data_dir(bio); int do_barriers; - if (unlikely(!mddev->barriers_work && bio_barrier(bio))) { - bio_endio(bio, bio->bi_size, -EOPNOTSUPP); - return 0; - } - /* * Register the new request and wait if the reconstruction * thread has put up a bar for new requests. * Continue immediately if no resync is active currently. + * We test barriers_work *after* md_write_start as md_write_start + * may cause the first superblock write, and that will check out + * if barriers work. */ + md_write_start(mddev, bio); /* wait on superblock update early */ + if (unlikely(!mddev->barriers_work && bio_barrier(bio))) { + if (rw == WRITE) + md_write_end(mddev); + bio_endio(bio, bio->bi_size, -EOPNOTSUPP); + return 0; + } + wait_barrier(conf); disk_stat_inc(mddev->gendisk, ios[rw]); |