diff options
author | NeilBrown <neilb@suse.de> | 2005-10-20 00:23:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-20 02:04:30 -0400 |
commit | 6985c43f39b3d799999c390099c56ebbee27d4f4 (patch) | |
tree | 7db2cc566d9257afca01deb135e2e0f0347333e8 /drivers/md/md.c | |
parent | 4a9949d7ac9e2bc51939f27b184be6e1bd99004e (diff) |
[PATCH] Three one-liners in md.c
The main problem fixes is that in certain situations stopping md arrays may
take longer than you expect, or may require multiple attempts. This would
only happen when resync/recovery is happening.
This patch fixes three vaguely related bugs.
1/ The recent change to use kthreads got the setting of the
process name wrong. This fixes it.
2/ The recent change to use kthreads lost the ability for
md threads to be signalled with SIG_KILL. This restores that.
3/ There is a long standing bug in that if:
- An array needs recovery (onto a hot-spare) and
- The recovery is being blocked because some other array being
recovered shares a physical device and
- The recovery thread is killed with SIG_KILL
Then the recovery will appear to have completed with no IO being
done, which can cause data corruption.
This patch makes sure that incomplete recovery will be treated as
incomplete.
Note that any kernel affected by bug 2 will not suffer the problem of bug
3, as the signal can never be delivered. Thus the current 2.6.14-rc
kernels are not susceptible to data corruption. Note also that if arrays
are shutdown (with "mdadm -S" or "raidstop") then the problem doesn't
occur. It only happens if a SIGKILL is independently delivered as done by
'init' when shutting down.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 2897df90df44..e9476075aa13 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -3063,6 +3063,7 @@ static int md_thread(void * arg) | |||
3063 | * many dirty RAID5 blocks. | 3063 | * many dirty RAID5 blocks. |
3064 | */ | 3064 | */ |
3065 | 3065 | ||
3066 | allow_signal(SIGKILL); | ||
3066 | complete(thread->event); | 3067 | complete(thread->event); |
3067 | while (!kthread_should_stop()) { | 3068 | while (!kthread_should_stop()) { |
3068 | void (*run)(mddev_t *); | 3069 | void (*run)(mddev_t *); |
@@ -3111,7 +3112,7 @@ mdk_thread_t *md_register_thread(void (*run) (mddev_t *), mddev_t *mddev, | |||
3111 | thread->mddev = mddev; | 3112 | thread->mddev = mddev; |
3112 | thread->name = name; | 3113 | thread->name = name; |
3113 | thread->timeout = MAX_SCHEDULE_TIMEOUT; | 3114 | thread->timeout = MAX_SCHEDULE_TIMEOUT; |
3114 | thread->tsk = kthread_run(md_thread, thread, mdname(thread->mddev)); | 3115 | thread->tsk = kthread_run(md_thread, thread, name, mdname(thread->mddev)); |
3115 | if (IS_ERR(thread->tsk)) { | 3116 | if (IS_ERR(thread->tsk)) { |
3116 | kfree(thread); | 3117 | kfree(thread); |
3117 | return NULL; | 3118 | return NULL; |
@@ -3569,6 +3570,7 @@ static void md_do_sync(mddev_t *mddev) | |||
3569 | try_again: | 3570 | try_again: |
3570 | if (signal_pending(current)) { | 3571 | if (signal_pending(current)) { |
3571 | flush_signals(current); | 3572 | flush_signals(current); |
3573 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); | ||
3572 | goto skip; | 3574 | goto skip; |
3573 | } | 3575 | } |
3574 | ITERATE_MDDEV(mddev2,tmp) { | 3576 | ITERATE_MDDEV(mddev2,tmp) { |