public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Moore, Eric Dean" <Eric.Moore@lsil.com>
To: linux scsi <linux-scsi@vger.kernel.org>
Cc: James Bottomley <James.Bottomley@SteelEye.com>
Subject: [PATCH] - mptfusion - adding back the spin locks in eh handlers
Date: Thu, 23 Jun 2005 12:20:08 -0600	[thread overview]
Message-ID: <200506231220.08036.Eric.Moore@lsil.com> (raw)

The eh handlers are called with host_lock acquired, and interrupts disabled.
However fusion waits for completion of task managment request.  With these spin locks 
removed, the driver is going to hang within the sleep calls.   Someone recently posted 
a patch to remove them(don´t know who),  and can be found in James Bottomely scsi-misc branch.  

Please apply.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>


diff -uarN b/drivers/message/fusion/mptscsih.c a/drivers/message/fusion/mptscsih.c
--- b/drivers/message/fusion/mptscsih.c	2005-06-23 11:18:44.000000000 -0600
+++ a/drivers/message/fusion/mptscsih.c	2005-05-10 14:27:13.000000000 -0600
@@ -1707,6 +1707,7 @@
 	MPT_FRAME_HDR	*mf;
 	u32		 ctx2abort;
 	int		 scpnt_idx;
+	spinlock_t	*host_lock = SCpnt->device->host->host_lock;
 
 	/* If we can't locate our host adapter structure, return FAILED status.
 	 */
@@ -1754,6 +1755,7 @@
 
 	hd->abortSCpnt = SCpnt;
 
+	spin_unlock_irq(host_lock);
 	if (mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK,
 		SCpnt->device->channel, SCpnt->device->id, SCpnt->device->lun,
 		ctx2abort, 2 /* 2 second timeout */)
@@ -1770,6 +1772,8 @@
 		hd->tmPending = 0;
 		hd->tmState = TM_STATE_NONE;
 
+		spin_lock_irq(host_lock);
+
 		/* Unmap the DMA buffers, if any. */
 		if (SCpnt->use_sg) {
 			pci_unmap_sg(ioc->pcidev, (struct scatterlist *) SCpnt->request_buffer,
@@ -1785,6 +1789,7 @@
 		mpt_free_msg_frame(ioc, mf);
 		return FAILED;
 	}
+	spin_lock_irq(host_lock);
 	return SUCCESS;
 }
 
@@ -1801,6 +1806,7 @@
 mptscsih_dev_reset(struct scsi_cmnd * SCpnt)
 {
 	MPT_SCSI_HOST	*hd;
+	spinlock_t	*host_lock = SCpnt->device->host->host_lock;
 
 	/* If we can't locate our host adapter structure, return FAILED status.
 	 */
@@ -1817,6 +1823,7 @@
 	printk(KERN_WARNING MYNAM ": %s: >> Attempting target reset! (sc=%p)\n",
 	       hd->ioc->name, SCpnt);
 
+	spin_unlock_irq(host_lock);
 	if (mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET,
 		SCpnt->device->channel, SCpnt->device->id,
 		0, 0, 5 /* 5 second timeout */)
@@ -1828,10 +1835,12 @@
 		 		hd->ioc->name, SCpnt);
 		hd->tmPending = 0;
 		hd->tmState = TM_STATE_NONE;
+		spin_lock_irq(host_lock);
 		return FAILED;
 	}
-
+	spin_lock_irq(host_lock);
 	return SUCCESS;
+
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -1865,6 +1874,7 @@
 		hd->timeouts++;
 
 	/* We are now ready to execute the task management request. */
+	spin_unlock_irq(host_lock);
 	if (mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS,
 		SCpnt->device->channel, 0, 0, 0, 5 /* 5 second timeout */)
 	    < 0){
@@ -1880,7 +1890,7 @@
 		spin_lock_irq(host_lock);
 		return FAILED;
 	}
-
+	spin_lock_irq(host_lock);
 	return SUCCESS;
 }
 
@@ -1899,6 +1909,7 @@
 {
 	MPT_SCSI_HOST *  hd;
 	int              status = SUCCESS;
+	spinlock_t	*host_lock = SCpnt->device->host->host_lock;
 
 	/*  If we can't locate the host to reset, then we failed. */
 	if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
@@ -1914,6 +1925,7 @@
 	/*  If our attempts to reset the host failed, then return a failed
 	 *  status.  The host will be taken off line by the SCSI mid-layer.
 	 */
+	spin_unlock_irq(host_lock);
 	if (mpt_HardResetHandler(hd->ioc, CAN_SLEEP) < 0){
 		status = FAILED;
 	} else {
@@ -1923,6 +1935,8 @@
 		hd->tmPending = 0;
 		hd->tmState = TM_STATE_NONE;
 	}
+	spin_lock_irq(host_lock);
+
 
 	dtmprintk( ( KERN_WARNING MYNAM ": mptscsih_host_reset: "
 		     "Status = %s\n",
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2005-06-23 18:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-23 18:20 Moore, Eric Dean [this message]
2005-06-23 19:04 ` [PATCH] - mptfusion - adding back the spin locks in eh handlers Luben Tuikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200506231220.08036.Eric.Moore@lsil.com \
    --to=eric.moore@lsil.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox