Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[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>

authored by

NeilBrown and committed by
Linus Torvalds
6985c43f 4a9949d7

+3 -1
+3 -1
drivers/md/md.c
··· 3063 3063 * many dirty RAID5 blocks. 3064 3064 */ 3065 3065 3066 + allow_signal(SIGKILL); 3066 3067 complete(thread->event); 3067 3068 while (!kthread_should_stop()) { 3068 3069 void (*run)(mddev_t *); ··· 3112 3111 thread->mddev = mddev; 3113 3112 thread->name = name; 3114 3113 thread->timeout = MAX_SCHEDULE_TIMEOUT; 3115 - thread->tsk = kthread_run(md_thread, thread, mdname(thread->mddev)); 3114 + thread->tsk = kthread_run(md_thread, thread, name, mdname(thread->mddev)); 3116 3115 if (IS_ERR(thread->tsk)) { 3117 3116 kfree(thread); 3118 3117 return NULL; ··· 3570 3569 try_again: 3571 3570 if (signal_pending(current)) { 3572 3571 flush_signals(current); 3572 + set_bit(MD_RECOVERY_INTR, &mddev->recovery); 3573 3573 goto skip; 3574 3574 } 3575 3575 ITERATE_MDDEV(mddev2,tmp) {