Commit ad42eb1b authored by Christoph Hellwig's avatar Christoph Hellwig Committed by James Bottomley

[SCSI] tidy up scsi_error_handler

adjust comments, remove a useless cast and remove a write-only variable.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 32565347
...@@ -1571,38 +1571,31 @@ static void scsi_unjam_host(struct Scsi_Host *shost) ...@@ -1571,38 +1571,31 @@ static void scsi_unjam_host(struct Scsi_Host *shost)
} }
/** /**
* scsi_error_handler - Handle errors/timeouts of SCSI cmds. * scsi_error_handler - SCSI error handler thread
* @data: Host for which we are running. * @data: Host for which we are running.
* *
* Notes: * Notes:
* This is always run in the context of a kernel thread. The idea is * This is the main error handling loop. This is run as a kernel thread
* that we start this thing up when the kernel starts up (one per host * for every SCSI host and handles all error handling activity.
* that we detect), and it immediately goes to sleep and waits for some
* event (i.e. failure). When this takes place, we have the job of
* trying to unjam the bus and restarting things.
**/ **/
int scsi_error_handler(void *data) int scsi_error_handler(void *data)
{ {
struct Scsi_Host *shost = (struct Scsi_Host *) data; struct Scsi_Host *shost = data;
int rtn;
current->flags |= PF_NOFREEZE; current->flags |= PF_NOFREEZE;
/* /*
* Note - we always use TASK_INTERRUPTIBLE even if the module * We use TASK_INTERRUPTIBLE so that the thread is not
* was loaded as part of the kernel. The reason is that * counted against the load average as a running process.
* UNINTERRUPTIBLE would cause this thread to be counted in * We never actually get interrupted because kthread_run
* the load average as a running process, and an interruptible * disables singal delivery for the created thread.
* wait doesn't.
*/ */
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
while (!kthread_should_stop()) { while (!kthread_should_stop()) {
if (shost->host_failed == 0 || if (shost->host_failed == 0 ||
shost->host_failed != shost->host_busy) { shost->host_failed != shost->host_busy) {
SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler" SCSI_LOG_ERROR_RECOVERY(1,
" scsi_eh_%d" printk("Error handler scsi_eh_%d sleeping\n",
" sleeping\n",
shost->host_no)); shost->host_no));
schedule(); schedule();
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
...@@ -1610,9 +1603,9 @@ int scsi_error_handler(void *data) ...@@ -1610,9 +1603,9 @@ int scsi_error_handler(void *data)
} }
__set_current_state(TASK_RUNNING); __set_current_state(TASK_RUNNING);
SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler" SCSI_LOG_ERROR_RECOVERY(1,
" scsi_eh_%d waking" printk("Error handler scsi_eh_%d waking up\n",
" up\n",shost->host_no)); shost->host_no));
shost->eh_active = 1; shost->eh_active = 1;
...@@ -1622,7 +1615,7 @@ int scsi_error_handler(void *data) ...@@ -1622,7 +1615,7 @@ int scsi_error_handler(void *data)
* If we fail, we end up taking the thing offline. * If we fail, we end up taking the thing offline.
*/ */
if (shost->hostt->eh_strategy_handler) if (shost->hostt->eh_strategy_handler)
rtn = shost->hostt->eh_strategy_handler(shost); shost->hostt->eh_strategy_handler(shost);
else else
scsi_unjam_host(shost); scsi_unjam_host(shost);
...@@ -1638,15 +1631,10 @@ int scsi_error_handler(void *data) ...@@ -1638,15 +1631,10 @@ int scsi_error_handler(void *data)
scsi_restart_operations(shost); scsi_restart_operations(shost);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
} }
__set_current_state(TASK_RUNNING); __set_current_state(TASK_RUNNING);
SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler scsi_eh_%d" SCSI_LOG_ERROR_RECOVERY(1,
" exiting\n",shost->host_no)); printk("Error handler scsi_eh_%d exiting\n", shost->host_no));
/*
* Make sure that nobody tries to wake us up again.
*/
shost->ehandler = NULL; shost->ehandler = NULL;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment