Commit 3f65bcdb authored by Christoph Hellwig's avatar Christoph Hellwig Committed by James Bottomley

[PATCH] handle failure when starting the eh thread

And while at it also fix the scsi_error_handler() prototype.
parent e56dbc2b
...@@ -263,7 +263,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) ...@@ -263,7 +263,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
rval = scsi_setup_command_freelist(shost); rval = scsi_setup_command_freelist(shost);
if (rval) if (rval)
goto fail; goto fail_kfree;
device_initialize(&shost->shost_gendev); device_initialize(&shost->shost_gendev);
snprintf(shost->shost_gendev.bus_id, BUS_ID_SIZE, "host%d", snprintf(shost->shost_gendev.bus_id, BUS_ID_SIZE, "host%d",
...@@ -277,13 +277,17 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) ...@@ -277,13 +277,17 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
shost->host_no); shost->host_no);
shost->eh_notify = &complete; shost->eh_notify = &complete;
/* XXX(hch): handle error return */ rval = kernel_thread(scsi_error_handler, shost, 0);
kernel_thread((int (*)(void *))scsi_error_handler, shost, 0); if (rval < 0)
goto fail_destroy_freelist;
wait_for_completion(&complete); wait_for_completion(&complete);
shost->eh_notify = NULL; shost->eh_notify = NULL;
scsi_proc_hostdir_add(shost->hostt); scsi_proc_hostdir_add(shost->hostt);
return shost; return shost;
fail:
fail_destroy_freelist:
scsi_destroy_command_freelist(shost);
fail_kfree:
kfree(shost); kfree(shost);
return NULL; return NULL;
} }
......
...@@ -1490,7 +1490,7 @@ static void scsi_unjam_host(struct Scsi_Host *shost) ...@@ -1490,7 +1490,7 @@ static void scsi_unjam_host(struct Scsi_Host *shost)
* event (i.e. failure). When this takes place, we have the job of * event (i.e. failure). When this takes place, we have the job of
* trying to unjam the bus and restarting things. * trying to unjam the bus and restarting things.
**/ **/
void scsi_error_handler(void *data) int scsi_error_handler(void *data)
{ {
struct Scsi_Host *shost = (struct Scsi_Host *) data; struct Scsi_Host *shost = (struct Scsi_Host *) data;
int rtn; int rtn;
...@@ -1594,6 +1594,7 @@ void scsi_error_handler(void *data) ...@@ -1594,6 +1594,7 @@ void scsi_error_handler(void *data)
* the way out the door. * the way out the door.
*/ */
complete_and_exit(shost->eh_notify, 0); complete_and_exit(shost->eh_notify, 0);
return 0;
} }
/* /*
......
...@@ -91,7 +91,7 @@ extern void scsi_exit_devinfo(void); ...@@ -91,7 +91,7 @@ extern void scsi_exit_devinfo(void);
/* scsi_error.c */ /* scsi_error.c */
extern void scsi_times_out(struct scsi_cmnd *cmd); extern void scsi_times_out(struct scsi_cmnd *cmd);
extern void scsi_error_handler(void *host); extern int scsi_error_handler(void *host);
extern int scsi_decide_disposition(struct scsi_cmnd *cmd); extern int scsi_decide_disposition(struct scsi_cmnd *cmd);
extern void scsi_eh_wakeup(struct Scsi_Host *shost); extern void scsi_eh_wakeup(struct Scsi_Host *shost);
extern int scsi_eh_scmd_add(struct scsi_cmnd *, int); extern int scsi_eh_scmd_add(struct scsi_cmnd *, int);
......
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