Re: BOGUS: megaraid changes

J.E.J. Bottomley (James.Bottomley@SteelEye.com)
Sun, 10 Nov 2002 11:32:47 -0500


alan@lxorguk.ukuu.org.uk said:
> I dont think panic() is needed bug a loud printk and maybe an error
> return from scsi_register() would do the trick. We do however have a
> couple of drivers where "pray, the firmware does all the work" is the
> right answer, but they really should be setting their own handler that
> delays rather than aborting/resetting/kicking offline

How about this? It doesn't panic, just refuses to attach the driver (although
this will still eventually cause a panic if your root fs is on it).

James

===== hosts.c 1.23 vs edited =====
--- 1.23/drivers/scsi/hosts.c Tue Nov 5 11:18:22 2002
+++ edited/hosts.c Sun Nov 10 10:17:32 2002
@@ -51,6 +51,22 @@

static int scsi_host_next_hn; /* host_no for next new host */
static int scsi_hosts_registered; /* cnt of registered scsi hosts */
+static int scsi_ignore_no_error_handling = 0;
+
+#ifdef MODULE
+MODULE_PARM(scsi_ignore_no_error_handling, "i");
+#else
+static int __init
+scsi_ignore_no_error_handling_setup(char *str)
+{
+ scsi_ignore_no_error_handling = 1;
+
+ return 1;
+}
+
+__setup("scsi_ignore_no_error_handling=", scsi_ignore_no_error_handling_setup)
;
+#endif
+

/**
* scsi_tp_for_each_host - call function for each scsi host off a template
@@ -345,6 +361,25 @@
int gfp_mask;
DECLARE_MUTEX_LOCKED(sem);

+ /*
+ * Determine host number. Check reserved first before allocating
+ * new one
+ */
+ hname = (shost_tp->proc_name) ? shost_tp->proc_name : "";
+ hname_len = strlen(hname);
+
+ /* Check to see if this host has any error handling facilities */
+ if(shost_tp->eh_strategy_handler == NULL &&
+ shost_tp->eh_abort_handler == NULL &&
+ shost_tp->eh_device_reset_handler == NULL &&
+ shost_tp->eh_bus_reset_handler == NULL &&
+ shost_tp->eh_host_reset_handler == NULL) {
+ printk(KERN_ERR "ERROR: SCSI host `%s' has no error
handling\nERROR: This is not a safe way to run your SCSI host\nERROR: The
error handling must be added to this driver\n", hname);
+ if(!scsi_ignore_no_error_handling) {
+ printk(KERN_ERR "ERROR: not attaching this
host.\n\nERROR: to force attachment, boot with the
scsi_ignore_no_error_handling flag");
+ return NULL;
+ }
+ }
gfp_mask = GFP_KERNEL;
if (shost_tp->unchecked_isa_dma && xtr_bytes)
gfp_mask |= __GFP_DMA;
@@ -356,13 +391,6 @@
}

memset(shost, 0, sizeof(struct Scsi_Host) + xtr_bytes);
-
- /*
- * Determine host number. Check reserved first before allocating
- * new one
- */
- hname = (shost_tp->proc_name) ? shost_tp->proc_name : "";
- hname_len = strlen(hname);

if (hname_len)
list_for_each(lh, &scsi_host_hn_list) {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/