summaryrefslogtreecommitdiffstats
path: root/drivers/md/raid10.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@cse.unsw.edu.au>2005-06-22 02:17:12 +0200
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-22 04:07:43 +0200
commit06d91a5fe0b50c9060e70bdf7786f8a3c66249db (patch)
tree95a8b9228534cebb12eb31c1cc9cc0c45f685410 /drivers/md/raid10.c
parent[PATCH] md: merge md_enter_safemode into md_check_recovery (diff)
downloadlinux-06d91a5fe0b50c9060e70bdf7786f8a3c66249db.tar.xz
linux-06d91a5fe0b50c9060e70bdf7786f8a3c66249db.zip
[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.c5
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)
return 0;
}
+ if (md_write_start(mddev, bio) == 0)
+ return 0;
+
/*
* Register the new request and wait if the reconstruction
* thread has put up a bar for new requests.
@@ -774,7 +777,7 @@ static int make_request(request_queue_t *q, struct bio * bio)
rcu_read_unlock();
atomic_set(&r10_bio->remaining, 1);
- md_write_start(mddev);
+
for (i = 0; i < conf->copies; i++) {
struct bio *mbio;
int d = r10_bio->devs[i].devnum;