[PATCH] tcm_qla2xxx: Don't do spin_unlock_irq() in interrupt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Roland Dreier <roland@xxxxxxxxxxxxxxx>

In qla24xx_send_cmd_to_target(), we can't drop hardware_lock with
spin_unlock_irq() around the call to ->handle_cmd(), as this can be
called from the qla2xxx interrupt handler (and we really shouldn't
reenable interrupts in an interrupt handler).

Therefore get rid of the unlock/relock and simply clear
cmd->locked_rsp, which will prevent the driver from trying to take
hardware_lock again.  Also get rid the unsafe use of spin_is_locked()
in tcm_qla2xxx_handle_cmd() -- if spin_is_locked() returns true,
there's no guarantee that the spinlock is held by the thread checking!

This patch has been tested with lockdep enabled, and I've not seen any
deadlocks or other locking issues related to this code.

Signed-off-by: Roland Dreier <roland@xxxxxxxxxxxxxxx>
---
 drivers/scsi/qla2xxx/qla_target.c               |    3 +--
 drivers/target/tcm_qla2xxx/tcm_qla2xxx_fabric.c |    7 -------
 2 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 4d54872..8512bf6 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -3170,10 +3170,9 @@ static int qla24xx_send_cmd_to_target(struct scsi_qla_host *vha, struct qla_tgt_
 	/*
 	 * Dispatch command to tcm_qla2xxx fabric module code
 	 */
-	spin_unlock_irq(&vha->hw->hardware_lock);
+	cmd->locked_rsp = 0;
 	ret = vha->hw->qla2x_tmpl->handle_cmd(vha, cmd, unpacked_lun, data_length,
 				fcp_task_attr, data_dir, bidi);
-	spin_lock_irq(&vha->hw->hardware_lock);
 	return ret;
 }
 
diff --git a/drivers/target/tcm_qla2xxx/tcm_qla2xxx_fabric.c b/drivers/target/tcm_qla2xxx/tcm_qla2xxx_fabric.c
index 1271d4e..fc90513 100644
--- a/drivers/target/tcm_qla2xxx/tcm_qla2xxx_fabric.c
+++ b/drivers/target/tcm_qla2xxx/tcm_qla2xxx_fabric.c
@@ -602,13 +602,6 @@ int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,
 	 * Locate the struct se_lun pointer and attach it to struct se_cmd
 	 */
 	if (transport_lookup_cmd_lun(se_cmd, lun) < 0) {
-		/*
-		 * Clear qla_tgt_cmd->locked_rsp as ha->hardware_lock
-		 * is already held here..
-		 */
-		if (spin_is_locked(&cmd->vha->hw->hardware_lock))
-			cmd->locked_rsp = 0;
-
 		/* NON_EXISTENT_LUN */
 		transport_send_check_condition_and_sense(se_cmd,
 				se_cmd->scsi_sense_reason, 0);
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux