Commit 62de608da0b0ab17d81a233b50d1e952b9816f69
Committed by
Linus Torvalds
1 parent
bea2771871
Exists in
master
and in
7 other branches
[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>
Showing 1 changed file with 11 additions and 5 deletions Side-by-side Diff
drivers/md/raid1.c
... | ... | @@ -753,17 +753,23 @@ |
753 | 753 | const int rw = bio_data_dir(bio); |
754 | 754 | int do_barriers; |
755 | 755 | |
756 | - if (unlikely(!mddev->barriers_work && bio_barrier(bio))) { | |
757 | - bio_endio(bio, bio->bi_size, -EOPNOTSUPP); | |
758 | - return 0; | |
759 | - } | |
760 | - | |
761 | 756 | /* |
762 | 757 | * Register the new request and wait if the reconstruction |
763 | 758 | * thread has put up a bar for new requests. |
764 | 759 | * Continue immediately if no resync is active currently. |
760 | + * We test barriers_work *after* md_write_start as md_write_start | |
761 | + * may cause the first superblock write, and that will check out | |
762 | + * if barriers work. | |
765 | 763 | */ |
764 | + | |
766 | 765 | md_write_start(mddev, bio); /* wait on superblock update early */ |
766 | + | |
767 | + if (unlikely(!mddev->barriers_work && bio_barrier(bio))) { | |
768 | + if (rw == WRITE) | |
769 | + md_write_end(mddev); | |
770 | + bio_endio(bio, bio->bi_size, -EOPNOTSUPP); | |
771 | + return 0; | |
772 | + } | |
767 | 773 | |
768 | 774 | wait_barrier(conf); |
769 | 775 |