diff options
author | NeilBrown <neilb@cse.unsw.edu.au> | 2005-06-21 20:17:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-21 22:07:43 -0400 |
commit | 06d91a5fe0b50c9060e70bdf7786f8a3c66249db (patch) | |
tree | 95a8b9228534cebb12eb31c1cc9cc0c45f685410 /drivers/md/raid6main.c | |
parent | fca4d848f0e6fafdc2b25f8a0cf1e76935f13ac2 (diff) |
[PATCH] md: improve locking on 'safemode' and move superblock writes
When md marks the superblock dirty before a write, it calls
generic_make_request (to write the superblock) from within
generic_make_request (to write the first dirty block), which could cause
problems later.
With this patch, the superblock write is always done by the helper thread, and
write request are delayed until that write completes.
Also, the locking around marking the array dirty and writing the superblock is
improved to avoid possible races.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/raid6main.c')
-rw-r--r-- | drivers/md/raid6main.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/md/raid6main.c b/drivers/md/raid6main.c index 9d0e0e42a3be..fede16c4e8f3 100644 --- a/drivers/md/raid6main.c +++ b/drivers/md/raid6main.c | |||
@@ -1570,6 +1570,9 @@ static int make_request (request_queue_t *q, struct bio * bi) | |||
1570 | sector_t logical_sector, last_sector; | 1570 | sector_t logical_sector, last_sector; |
1571 | struct stripe_head *sh; | 1571 | struct stripe_head *sh; |
1572 | 1572 | ||
1573 | if (md_write_start(mddev, bi)==0) | ||
1574 | return 0; | ||
1575 | |||
1573 | if (bio_data_dir(bi)==WRITE) { | 1576 | if (bio_data_dir(bi)==WRITE) { |
1574 | disk_stat_inc(mddev->gendisk, writes); | 1577 | disk_stat_inc(mddev->gendisk, writes); |
1575 | disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bi)); | 1578 | disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bi)); |
@@ -1583,8 +1586,7 @@ static int make_request (request_queue_t *q, struct bio * bi) | |||
1583 | 1586 | ||
1584 | bi->bi_next = NULL; | 1587 | bi->bi_next = NULL; |
1585 | bi->bi_phys_segments = 1; /* over-loaded to count active stripes */ | 1588 | bi->bi_phys_segments = 1; /* over-loaded to count active stripes */ |
1586 | if ( bio_data_dir(bi) == WRITE ) | 1589 | |
1587 | md_write_start(mddev); | ||
1588 | for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) { | 1590 | for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) { |
1589 | DEFINE_WAIT(w); | 1591 | DEFINE_WAIT(w); |
1590 | 1592 | ||