diff --exclude='*~' -urN 2.6.9-rc4-mm1-RT-U7/drivers/scsi/hosts.c 2.6.9-rc4-mm1-RT-U7-work/drivers/scsi/hosts.c --- 2.6.9-rc4-mm1-RT-U7/drivers/scsi/hosts.c 2004-10-12 09:41:34.000000000 +0200 +++ 2.6.9-rc4-mm1-RT-U7-work/drivers/scsi/hosts.c 2004-10-20 03:32:10.000000000 +0200 @@ -149,7 +149,7 @@ DECLARE_COMPLETION(sem); shost->eh_notify = &sem; shost->eh_kill = 1; - up(shost->eh_wait); + wake_up(shost->eh_wait); wait_for_completion(&sem); shost->eh_notify = NULL; } diff --exclude='*~' -urN 2.6.9-rc4-mm1-RT-U7/drivers/scsi/scsi_error.c 2.6.9-rc4-mm1-RT-U7-work/drivers/scsi/scsi_error.c --- 2.6.9-rc4-mm1-RT-U7/drivers/scsi/scsi_error.c 2004-10-19 20:29:46.000000000 +0200 +++ 2.6.9-rc4-mm1-RT-U7-work/drivers/scsi/scsi_error.c 2004-10-20 05:31:20.000000000 +0200 @@ -49,7 +49,7 @@ void scsi_eh_wakeup(struct Scsi_Host *shost) { if (shost->host_busy == shost->host_failed) { - up(shost->eh_wait); + wake_up(shost->eh_wait); SCSI_LOG_ERROR_RECOVERY(5, printk("Waking error handler thread\n")); } @@ -1599,9 +1599,8 @@ { struct Scsi_Host *shost = (struct Scsi_Host *) data; int rtn; - DECLARE_MUTEX(sem); + DECLARE_WAIT_QUEUE_HEAD(eh_wait); - init_MUTEX_LOCKED(&sem); /* * Flush resources */ @@ -1610,7 +1609,7 @@ current->flags |= PF_NOFREEZE; - shost->eh_wait = &sem; + shost->eh_wait = &eh_wait; shost->ehandler = current; /* @@ -1632,15 +1631,12 @@ " sleeping\n",shost->host_no)); /* - * Note - we always use down_interruptible with the semaphore - * even if the module was loaded as part of the kernel. The - * reason is that down() will cause this thread to be counted - * in the load average as a running process, and down - * interruptible doesn't. Given that we need to allow this - * thread to die if the driver was loaded as a module, using - * semaphores isn't unreasonable. + * Wait, until somebody decides to wake us due to an error + * or because we should be killed */ - down_interruptible(&sem); + wait_event_interruptible(eh_wait, shost->eh_kill || + (shost->host_busy == shost->host_failed)); + if (shost->eh_kill) break; diff --exclude='*~' -urN 2.6.9-rc4-mm1-RT-U7/include/scsi/scsi_host.h 2.6.9-rc4-mm1-RT-U7-work/include/scsi/scsi_host.h --- 2.6.9-rc4-mm1-RT-U7/include/scsi/scsi_host.h 2004-10-12 09:42:00.000000000 +0200 +++ 2.6.9-rc4-mm1-RT-U7-work/include/scsi/scsi_host.h 2004-10-20 03:42:05.000000000 +0200 @@ -396,7 +396,7 @@ struct list_head eh_cmd_q; struct task_struct * ehandler; /* Error recovery thread. */ - struct semaphore * eh_wait; /* The error recovery thread waits + wait_queue_head_t * eh_wait; /* The error recovery thread waits on this. */ struct completion * eh_notify; /* wait for eh to begin or end */ struct semaphore * eh_action; /* Wait for specific actions on the