[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>
This commit is contained in:
committed by
Linus Torvalds
parent
fca4d848f0
commit
06d91a5fe0
@@ -530,6 +530,8 @@ static int make_request(request_queue_t *q, struct bio * bio)
|
||||
* thread has put up a bar for new requests.
|
||||
* Continue immediately if no resync is active currently.
|
||||
*/
|
||||
if (md_write_start(mddev, bio)==0)
|
||||
return 0;
|
||||
spin_lock_irq(&conf->resync_lock);
|
||||
wait_event_lock_irq(conf->wait_resume, !conf->barrier, conf->resync_lock, );
|
||||
conf->nr_pending++;
|
||||
@@ -611,7 +613,7 @@ static int make_request(request_queue_t *q, struct bio * bio)
|
||||
rcu_read_unlock();
|
||||
|
||||
atomic_set(&r1_bio->remaining, 1);
|
||||
md_write_start(mddev);
|
||||
|
||||
for (i = 0; i < disks; i++) {
|
||||
struct bio *mbio;
|
||||
if (!r1_bio->bios[i])
|
||||
|
Reference in New Issue
Block a user