handle failure when starting the eh thread
PATCH 1/1 handle failure when starting the eh thread
And while at it also fix the scsi_error_handler() prototype.
drivers/scsi/hosts.c +8 -4
@@ -262,7 +262,7 @@ rval =scsi_setup_command_freelist (shost);if (rval) - goto fail; + goto fail_kfree;device_initialize (&shost->shost_gendev); snprintf(shost->shost_gendev.bus_id, BUS_ID_SIZE, "host%d",
@@ -276,13 +276,17 @@ shost->host_no); shost->eh_notify = &complete; -/* XXX(hch): handle error return */ -kernel_thread ((int (*)(void *))scsi_error_handler, shost,0 ); + rval =kernel_thread (scsi_error_handler, shost,0 ); +if (rval <0 ) + goto fail_destroy_freelist;wait_for_completion (&complete); shost->eh_notify =NULL ;scsi_proc_hostdir_add (shost->hostt);return shost; - fail: + + fail_destroy_freelist: +scsi_destroy_command_freelist (shost); + fail_kfree:kfree (shost);return NULL ; }
drivers/scsi/scsi_error.c +2 -1
@@ -1490,7 +1490,7 @@* event (i.e. failure). When this takes place, we have the job of * 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;int rtn;
@@ -1594,6 +1594,7 @@* the way out the door. */ complete_and_exit (shost->eh_notify,0 ); +return 0 ; }/*
drivers/scsi/scsi_priv.h +1 -1
@@ -91,7 +91,7 @@/* scsi_error.c */ 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 void scsi_eh_wakeup (struct Scsi_Host *shost);extern int scsi_eh_scmd_add (struct scsi_cmnd *,int );