[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
@@ -15,6 +15,9 @@
|
||||
#ifndef _MD_K_H
|
||||
#define _MD_K_H
|
||||
|
||||
/* and dm-bio-list.h is not under include/linux because.... ??? */
|
||||
#include "../../../drivers/md/dm-bio-list.h"
|
||||
|
||||
#define MD_RESERVED 0UL
|
||||
#define LINEAR 1UL
|
||||
#define RAID0 2UL
|
||||
@@ -252,6 +255,10 @@ struct mddev_s
|
||||
atomic_t recovery_active; /* blocks scheduled, but not written */
|
||||
wait_queue_head_t recovery_wait;
|
||||
sector_t recovery_cp;
|
||||
|
||||
spinlock_t write_lock;
|
||||
struct bio_list write_list;
|
||||
|
||||
unsigned int safemode; /* if set, update "clean" superblock
|
||||
* when no writes pending.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user