public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] handle failure when starting the eh thread
@ 2003-09-21 16:44 Christoph Hellwig
  0 siblings, 0 replies; only message in thread
From: Christoph Hellwig @ 2003-09-21 16:44 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi

And while at it also fix the scsi_error_handler() prototype.


--- 1.91/drivers/scsi/hosts.c	Wed Sep  3 23:53:20 2003
+++ edited/drivers/scsi/hosts.c	Sun Sep 21 17:52:38 2003
@@ -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;
 }
--- 1.63/drivers/scsi/scsi_error.c	Sat Sep 20 11:11:42 2003
+++ edited/drivers/scsi/scsi_error.c	Sun Sep 21 17:49:36 2003
@@ -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;
 }
 
 /*
--- 1.26/drivers/scsi/scsi_priv.h	Mon Aug 25 15:37:25 2003
+++ edited/drivers/scsi/scsi_priv.h	Sun Sep 21 17:49:44 2003
@@ -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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-09-21 16:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-21 16:44 [PATCH] handle failure when starting the eh thread Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox