Skip to contentSkip to conversation

sym2 error handler sleeps with irqs off

PATCH Anton Blanchard 2 participants 2 messages Jul 11, 2003 – Jul 13, 2003

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

Hi,

The scsi error handler calls driver error handlers with the host_lock taken. We need to drop it before calling down() in the sym2 driver.

Anton

===== drivers/scsi/sym53c8xx_2/sym_glue.c 1.13 vs edited =====

drivers/scsi/sym53c8xx_2/sym_glue.c +5 -0
@@ -1112,6 +1112,7 @@
 	int sts = -1;
 	struct sym_eh_wait eh, *ep = &eh;
 	char devname[20];
+	unsigned long flags;
 
 	sprintf(devname, "%s:%d:%d", sym_name(np), cmd->device->id, cmd->device->lun);
 
@@ -1203,7 +1204,11 @@
 		ep->timer.data = (u_long)cmd;
 		ep->timed_out = 1;	/* Be pessimistic for once :) */
 		add_timer(&ep->timer);
+		local_save_flags(flags);
+		spin_unlock_irq(cmd->device->host->host_lock);
 		down(&ep->sem);
+		local_irq_restore(flags);
+		spin_lock(cmd->device->host->host_lock);
 		if (ep->timed_out)
 			sts = -2;
 	}
#1 lore raw

drivers/scsi/sym53c8xx_2/sym_glue.c line 1207

Quoted 1 line · Anton Blanchard
drivers/scsi/sym53c8xx_2/sym_glue.c +1 -0
+		local_save_flags(flags);

I don't think you need to save the flags.

drivers/scsi/sym53c8xx_2/sym_glue.c line 1211

Quoted 4 lines
drivers/scsi/sym53c8xx_2/sym_glue.c +3 -0
+		spin_unlock_irq(cmd->device->host->host_lock);
 		down(&ep->sem);
+		local_irq_restore(flags);
+		spin_lock(cmd->device->host->host_lock);

When we drop it we should probably drop it as long as it's safe.