Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 13908
b: refs/heads/master
c: ad42eb1
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Hellwig authored and James Bottomley committed Nov 6, 2005
1 parent 899f501 commit 928f2cf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3256534776203d4d86fea508e66cfde2b06d39a2
refs/heads/master: ad42eb1b77b9c17065dc52bcab3f5e1cfb3535b9
46 changes: 17 additions & 29 deletions trunk/drivers/scsi/scsi_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -1571,48 +1571,41 @@ 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.
*
* Notes:
* This is always run in the context of a kernel thread. The idea is
* that we start this thing up when the kernel starts up (one per host
* 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.
* This is the main error handling loop. This is run as a kernel thread
* for every SCSI host and handles all error handling activity.
**/
int scsi_error_handler(void *data)
{
struct Scsi_Host *shost = (struct Scsi_Host *) data;
int rtn;
struct Scsi_Host *shost = data;

current->flags |= PF_NOFREEZE;


/*
* Note - we always use TASK_INTERRUPTIBLE even if the module
* was loaded as part of the kernel. The reason is that
* UNINTERRUPTIBLE would cause this thread to be counted in
* the load average as a running process, and an interruptible
* wait doesn't.
* We use TASK_INTERRUPTIBLE so that the thread is not
* counted against the load average as a running process.
* We never actually get interrupted because kthread_run
* disables singal delivery for the created thread.
*/
set_current_state(TASK_INTERRUPTIBLE);
while (!kthread_should_stop()) {
if (shost->host_failed == 0 ||
shost->host_failed != shost->host_busy) {
SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler"
" scsi_eh_%d"
" sleeping\n",
shost->host_no));
SCSI_LOG_ERROR_RECOVERY(1,
printk("Error handler scsi_eh_%d sleeping\n",
shost->host_no));
schedule();
set_current_state(TASK_INTERRUPTIBLE);
continue;
}

__set_current_state(TASK_RUNNING);
SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler"
" scsi_eh_%d waking"
" up\n",shost->host_no));
SCSI_LOG_ERROR_RECOVERY(1,
printk("Error handler scsi_eh_%d waking up\n",
shost->host_no));

shost->eh_active = 1;

Expand All @@ -1622,7 +1615,7 @@ int scsi_error_handler(void *data)
* If we fail, we end up taking the thing offline.
*/
if (shost->hostt->eh_strategy_handler)
rtn = shost->hostt->eh_strategy_handler(shost);
shost->hostt->eh_strategy_handler(shost);
else
scsi_unjam_host(shost);

Expand All @@ -1638,15 +1631,10 @@ int scsi_error_handler(void *data)
scsi_restart_operations(shost);
set_current_state(TASK_INTERRUPTIBLE);
}

__set_current_state(TASK_RUNNING);

SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler scsi_eh_%d"
" exiting\n",shost->host_no));

/*
* Make sure that nobody tries to wake us up again.
*/
SCSI_LOG_ERROR_RECOVERY(1,
printk("Error handler scsi_eh_%d exiting\n", shost->host_no));
shost->ehandler = NULL;
return 0;
}
Expand Down

0 comments on commit 928f2cf

Please sign in to comment.