Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93588e22 authored by NeilBrown's avatar NeilBrown Committed by Linus Torvalds
Browse files

[PATCH] md: make md threads interruptible again



Despite the fact that md threads don't need to be signalled, and won't
respond to signals anyway, we need to have an 'interruptible' wait, else
they stay in 'D' state and add to the load average.

(akpm: the signal_pending() test is unneeded - we'll fix that up in the next
round.  For now, leave it there because that's how the code used to be).

Signed-off-by: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e8a00334
Loading
Loading
Loading
Loading
+13 −4
Original line number Original line Diff line number Diff line
@@ -3437,7 +3437,16 @@ static int md_thread(void * arg)
	allow_signal(SIGKILL);
	allow_signal(SIGKILL);
	while (!kthread_should_stop()) {
	while (!kthread_should_stop()) {


		wait_event_timeout(thread->wqueue,
		/* We need to wait INTERRUPTIBLE so that
		 * we don't add to the load-average.
		 * That means we need to be sure no signals are
		 * pending
		 */
		if (signal_pending(current))
			flush_signals(current);

		wait_event_interruptible_timeout
			(thread->wqueue,
			 test_bit(THREAD_WAKEUP, &thread->flags)
			 test_bit(THREAD_WAKEUP, &thread->flags)
			 || kthread_should_stop(),
			 || kthread_should_stop(),
			 thread->timeout);
			 thread->timeout);