From: Andrew Morton <akpm@osdl.org>

<head spins>

scsi_dispatch_cmd() takes ->host_lock before calling ->queuecommand(), so
ahd_linux_queue(), which is the ->queuecommand() implementation best not try
to take it again.

So undo an earlier patch and remove that locking from ahd_linux_queue().

Now it boots.

Cc: James Bottomley <James.Bottomley@steeleye.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 drivers/scsi/aic7xxx/aic79xx_osm.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff -puN drivers/scsi/aic7xxx/aic79xx_osm.c~aic79xx-deadlock-fix-3 drivers/scsi/aic7xxx/aic79xx_osm.c
--- 25/drivers/scsi/aic7xxx/aic79xx_osm.c~aic79xx-deadlock-fix-3	2005-06-18 23:59:28.000000000 -0700
+++ 25-akpm/drivers/scsi/aic7xxx/aic79xx_osm.c	2005-06-18 23:59:28.000000000 -0700
@@ -932,7 +932,6 @@ ahd_linux_queue(Scsi_Cmnd * cmd, void (*
 {
 	struct	 ahd_softc *ahd;
 	struct	 ahd_linux_device *dev;
-	u_long	 flags;
 	int	 ret = 0;
 
 	ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
@@ -942,8 +941,6 @@ ahd_linux_queue(Scsi_Cmnd * cmd, void (*
 	 */
 	cmd->scsi_done = scsi_done;
 
-	ahd_lock(ahd, &flags);
-
 	/*
 	 * Close the race of a command that was in the process of
 	 * being queued to us just as our simq was frozen.  Let
@@ -981,7 +978,6 @@ ahd_linux_queue(Scsi_Cmnd * cmd, void (*
 		ahd_linux_run_device_queues(ahd);
 	}
 out:
-	ahd_unlock(ahd, &flags);
 	return ret;
 }
 
@@ -2743,13 +2739,15 @@ ahd_linux_dv_target(struct ahd_softc *ah
 		 * ahd host lock held.  For other kernels, the
 		 * io_request_lock must be held.
 		 */
-#if AHD_SCSI_HAS_HOST_LOCK == 0
+#if AHD_SCSI_HAS_HOST_LOCK != 0
+		ahd_lock(ahd, &s);
+#else
 		spin_lock_irqsave(&io_request_lock, s);
 #endif
-
 		ahd_linux_queue(cmd, ahd_linux_dv_complete);
-
-#if AHD_SCSI_HAS_HOST_LOCK == 0
+#if AHD_SCSI_HAS_HOST_LOCK != 0
+		ahd_unlock(ahd, &s);
+#else
 		spin_unlock_irqrestore(&io_request_lock, s);
 #endif
 		down_interruptible(&ahd->platform_data->dv_cmd_sem);
_