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/raid10.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/raid10.c')
-rw-r--r-- | drivers/md/raid10.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 9ae21504db8a..bfc9f52f0ecf 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -700,6 +700,9 @@ static int make_request(request_queue_t *q, struct bio * bio) | |||
700 | return 0; | 700 | return 0; |
701 | } | 701 | } |
702 | 702 | ||
703 | if (md_write_start(mddev, bio) == 0) | ||
704 | return 0; | ||
705 | |||
703 | /* | 706 | /* |
704 | * Register the new request and wait if the reconstruction | 707 | * Register the new request and wait if the reconstruction |
705 | * thread has put up a bar for new requests. | 708 | * thread has put up a bar for new requests. |
@@ -774,7 +777,7 @@ static int make_request(request_queue_t *q, struct bio * bio) | |||
774 | rcu_read_unlock(); | 777 | rcu_read_unlock(); |
775 | 778 | ||
776 | atomic_set(&r10_bio->remaining, 1); | 779 | atomic_set(&r10_bio->remaining, 1); |
777 | md_write_start(mddev); | 780 | |
778 | for (i = 0; i < conf->copies; i++) { | 781 | for (i = 0; i < conf->copies; i++) { |
779 | struct bio *mbio; | 782 | struct bio *mbio; |
780 | int d = r10_bio->devs[i].devnum; | 783 | int d = r10_bio->devs[i].devnum; |