aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-07-10 04:44:15 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-10 13:24:16 -0700
commit0b8c9de05c2a860fe6b02fedcb48763bcee648b3 (patch)
tree893228041dfcc44a216a6887e75c2424e0a8bca9 /drivers
parent31b65a0d3894566191b91fbadd122c354a363b5d (diff)
downloadlinux-0b8c9de05c2a860fe6b02fedcb48763bcee648b3.tar.gz
[PATCH] md: delay starting md threads until array is completely setup
When an array is started we start one or two threads (two if there is a reshape or recovery that needs to be completed). We currently start these *before* the array is completely set up and in particular before queue->queuedata is set. If the thread actually starts very quickly on another CPU, we can end up dereferencing queue->queuedata and oops. This patch also makes sure we don't try to start a recovery if a reshape is being restarted. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/md.c8
-rw-r--r--drivers/md/raid5.c3
2 files changed, 4 insertions, 7 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 9f76e0cd7805a1..fb50e5642c6305 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3095,7 +3095,6 @@ static int do_md_run(mddev_t * mddev)
}
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
- md_wakeup_thread(mddev->thread);
if (mddev->sb_dirty)
md_update_sb(mddev);
@@ -3116,7 +3115,7 @@ static int do_md_run(mddev_t * mddev)
* start recovery here. If we leave it to md_check_recovery,
* it will remove the drives and not do the right thing
*/
- if (mddev->degraded) {
+ if (mddev->degraded && !mddev->sync_thread) {
struct list_head *rtmp;
int spares = 0;
ITERATE_RDEV(mddev,rdev,rtmp)
@@ -3137,10 +3136,11 @@ static int do_md_run(mddev_t * mddev)
mdname(mddev));
/* leave the spares where they are, it shouldn't hurt */
mddev->recovery = 0;
- } else
- md_wakeup_thread(mddev->sync_thread);
+ }
}
}
+ md_wakeup_thread(mddev->thread);
+ md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */
mddev->changed = 1;
md_new_event(mddev);
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 5764387c69896f..a02f35f1a796b6 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3246,9 +3246,6 @@ static int run(mddev_t *mddev)
set_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
mddev->sync_thread = md_register_thread(md_do_sync, mddev,
"%s_reshape");
- /* FIXME if md_register_thread fails?? */
- md_wakeup_thread(mddev->sync_thread);
-
}
/* read-ahead size must cover two whole stripes, which is