Skip to contentSkip to conversation

(hopefully) final SCSI fixes for 2.6.19

PATCH In review James Bottomley 3 participants 7 messages Sep 14, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 (hopefully) final SCSI fixes for 2.6.19

The patch is here

master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6.git

However, as there's only a single patch in there, I attach it in case you'd prefer simply to apply it as a patch rather than merge a single patch tree.

James

---

commit 15d100224c123f0f993ef88e95fd5d46bb0bd085

Author: James Smart <[email protected]>
Date:   Thu Aug 31 12:27:57 2006 -0400

[SCSI] lpfc: don't free mempool if mailbox is busy

drivers/scsi/lpfc/lpfc_init.c +4 -2
index f6948ff..c31fe41 100644
@@ -387,7 +387,8 @@ lpfc_config_port_post(struct lpfc_hba * 
 
 	lpfc_init_link(phba, pmb, phba->cfg_topology, phba->cfg_link_speed);
 	pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
-	if (lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT) != MBX_SUCCESS) {
+	rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
+	if (rc != MBX_SUCCESS) {
 		lpfc_printf_log(phba,
 				KERN_ERR,
 				LOG_INIT,
@@ -404,7 +405,8 @@ lpfc_config_port_post(struct lpfc_hba * 
 		readl(phba->HAregaddr); /* flush */
 
 		phba->hba_state = LPFC_HBA_ERROR;
-		mempool_free(pmb, phba->mbox_mem_pool);
+		if (rc != MBX_BUSY)
+			mempool_free(pmb, phba->mbox_mem_pool);
 		return -EIO;
 	}
 	/* MBOX buffer will be freed in mbox compl */
#1 lore raw
Quoted 7 lines · On Thu, 14 Sep 2006 16:12:58 -0500 James Bottomley…

The patch is here

master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6.git

However, as there's only a single patch in there, I attach it in case you'd prefer simply to apply it as a patch rather than merge a single patch tree.

<digs around>

ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.18-rc6/2.6.18-rc6-mm2/broken-out/fix-panic-when-reinserting-adaptec-pcmcia-scsi-card.patch might be handy too. Your ack is my command.

#2 lore raw
Quoted 2 lines · Andrew Morton

ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.18-rc6/2.6.18-rc6-mm2/broken-out/fix-panic-when-reinserting-adaptec-pcmcia-scsi-card.patch might be handy too. Your ack is my command.

Well ... no, not really, on the grounds that the patch is wrong.

The correct fix is to eliminate the aha152x_host array by converting the driver to the correct driver model ... I just haven't had time to look at doing that yet.

James

#3 lore raw
Quoted 5 lines · On Thu, 14 Sep 2006 16:37:39 -0500 James Bottomley…
Quoted 2 lines · Andrew Morton

ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.18-rc6/2.6.18-rc6-mm2/broken-out/fix-panic-when-reinserting-adaptec-pcmcia-scsi-card.patch might be handy too. Your ack is my command.

Well ... no, not really, on the grounds that the patch is wrong.

So is oopsing ;)

Quoted 3 lines

The correct fix is to eliminate the aha152x_host array by converting the driver to the correct driver model ... I just haven't had time to look at doing that yet.

<lachrymose>If we'd been told that on July 8 and/or August 14, this might be fixed by now</>

Perhaps Alex might like to take a look into doing this (please)?

#4 lore raw
Quoted 2 lines · Andrew Morton

<lachrymose>If we'd been told that on July 8 and/or August 14, this might be fixed by now</>

OK, so mea culpa, I'll make amends

Quoted 1 line

Perhaps Alex might like to take a look into doing this (please)?

Just test out this patch, please ...

James

drivers/scsi/aha152x.c +24 -29
index f974869..7fd56b8 100644
@@ -253,6 +253,7 @@ #include <linux/kernel.h>
 #include <linux/isapnp.h>
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
+#include <linux/list.h>
 #include <asm/semaphore.h>
 #include <scsi/scsicam.h>
 
@@ -262,6 +263,8 @@ #include <scsi/scsi_host.h>
 #include <scsi/scsi_transport_spi.h>
 #include "aha152x.h"
 
+static LIST_HEAD(aha152x_host_list);
+
 
 /* DEFINES */
 
@@ -423,8 +426,6 @@ #endif /* ISAPNP */
 
 #endif /* !PCMCIA */
 
-static int registered_count=0;
-static struct Scsi_Host *aha152x_host[2];
 static struct scsi_host_template aha152x_driver_template;
 
 /*
@@ -541,6 +542,7 @@ #endif
 #ifdef __ISAPNP__
 	struct pnp_dev *pnpdev;
 #endif
+	struct list_head host_list;
 };
 
 
@@ -755,20 +757,9 @@ static inline Scsi_Cmnd *remove_SC(Scsi_
 	return ptr;
 }
 
-static inline struct Scsi_Host *lookup_irq(int irqno)
-{
-	int i;
-
-	for(i=0; i<ARRAY_SIZE(aha152x_host); i++)
-		if(aha152x_host[i] && aha152x_host[i]->irq==irqno)
-			return aha152x_host[i];
-
-	return NULL;
-}
-
 static irqreturn_t swintr(int irqno, void *dev_id, struct pt_regs *regs)
 {
-	struct Scsi_Host *shpnt = lookup_irq(irqno);
+	struct Scsi_Host *shpnt = (struct Scsi_Host *)dev_id;
 
 	if (!shpnt) {
         	printk(KERN_ERR "aha152x: catched software interrupt %d for unknown controller.\n", irqno);
@@ -791,10 +782,11 @@ struct Scsi_Host *aha152x_probe_one(stru
 		return NULL;
 	}
 
-	/* need to have host registered before triggering any interrupt */
-	aha152x_host[registered_count] = shpnt;
-
 	memset(HOSTDATA(shpnt), 0, sizeof *HOSTDATA(shpnt));
+	INIT_LIST_HEAD(&HOSTDATA(shpnt)->host_list);
+
+	/* need to have host registered before triggering any interrupt */
+	list_add_tail(&HOSTDATA(shpnt)->host_list, &aha152x_host_list);
 
 	shpnt->io_port   = setup->io_port;
 	shpnt->n_io_port = IO_RANGE;
@@ -907,12 +899,10 @@ #endif
 
 	scsi_scan_host(shpnt);
 
-	registered_count++;
-
 	return shpnt;
 
 out_host_put:
-	aha152x_host[registered_count]=NULL;
+	list_del(&HOSTDATA(shpnt)->host_list);
 	scsi_host_put(shpnt);
 
 	return NULL;
@@ -937,6 +927,7 @@ #ifdef __ISAPNP__
 #endif
 
 	scsi_remove_host(shpnt);
+	list_del(&HOSTDATA(shpnt)->host_list);
 	scsi_host_put(shpnt);
 }
 
@@ -1459,9 +1450,12 @@ static struct work_struct aha152x_tq;
  */
 static void run(void)
 {
-	int i;
-	for (i = 0; i<ARRAY_SIZE(aha152x_host); i++) {
-		is_complete(aha152x_host[i]);
+	struct aha152x_hostdata *hd;
+
+	list_for_each_entry(hd, &aha152x_host_list, host_list) {
+		struct Scsi_Host *shost = container_of((void *)hd, struct Scsi_Host, hostdata);
+		
+		is_complete(shost);
 	}
 }
 
@@ -1471,7 +1465,7 @@ static void run(void)
  */
 static irqreturn_t intr(int irqno, void *dev_id, struct pt_regs *regs)
 {
-	struct Scsi_Host *shpnt = lookup_irq(irqno);
+	struct Scsi_Host *shpnt = (struct Scsi_Host *)dev_id;
 	unsigned long flags;
 	unsigned char rev, dmacntrl0;
 
@@ -3953,16 +3947,17 @@ #if defined(__ISAPNP__)
 #endif
 	}
 
-	return registered_count>0;
+	return 1;
 }
 
 static void __exit aha152x_exit(void)
 {
-	int i;
+	struct aha152x_hostdata *hd;
 
-	for(i=0; i<ARRAY_SIZE(setup); i++) {
-		aha152x_release(aha152x_host[i]);
-		aha152x_host[i]=NULL;
+	list_for_each_entry(hd, &aha152x_host_list, host_list) {
+		struct Scsi_Host *shost = container_of((void *)hd, struct Scsi_Host, hostdata);
+		
+		aha152x_release(shost);
 	}
 }
 
#6 lore raw
Quoted 1 line · Douglas Gilbert

Is the door already closed for patches to lk 2.6.19 ?

It ain't over until the fat penguin sings.

But I know of no major outstanding issues which would justify an emergency fix at this stage.

James