On Sun, 29 Oct 2006 23:26:56 +0100, Heiko Carstens <heiko.carstens@xxxxxxxxxx> wrote: > What could happen: > - code is in erp thread loop before down_interruptible(erp_ready_sem) > - thread should be killed: somebody calls kthread_stop() hence > kthread_should_stop() gets true. But since the thread is not sleeping > (yet) there is no need to wake it. So kthread_stop() just waits. > - erp thread comes to down_interruptible(erp_ready_sem) and sleeps. > - the only "up" that would wake up the erp_thread comes after your > kthread_stop() which is waits that the thread terminates -> deadlock. Grmpf, you're right. And even checking kthread_should_stop() immediately before going to sleep would be racy. We need to up() after we set should_stop and wait afterwards... Please drop this patch for now until I have time to sort it out. -- Cornelia Huck Linux for zSeries Developer Tel.: +49-7031-16-4837, Mail: cornelia.huck@xxxxxxxxxx - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html