[PATCH] qla2xxx: Fix a possible hang on target shutdown

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

 



From: Roland Dreier <roland@xxxxxxxxxxxxxxx>

If tgt->tgt_stop is set, current code in qla_tgt_do_work() jumps to the
exit path before setting sess, so the code

        if (sess)
                __qla_tgt_sess_put(sess);

skips the kref_put() and therefore sess is be left with an extra
reference forever.  When this happens, qla_tgt_stop_phase1() waits
forever for all the sessions to go away.  Fix this by making sure sess
is always set in qla_tgt_do_work().

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

diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index b1ef4b1..51de953 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -2955,7 +2955,7 @@ static void qla_tgt_do_work(struct work_struct *work)
 	scsi_qla_host_t *vha = cmd->vha;
 	struct qla_hw_data *ha = vha->hw;
 	struct qla_tgt *tgt = ha->qla_tgt;
-	struct qla_tgt_sess *sess = NULL;
+	struct qla_tgt_sess *sess = cmd->sess;
 	atio_from_isp_t *atio = &cmd->atio;
 	unsigned char *cdb;
 	unsigned long flags;
@@ -2965,7 +2965,6 @@ static void qla_tgt_do_work(struct work_struct *work)
 	if (tgt->tgt_stop)
 		goto out_term;	
 
-	sess = cmd->sess;
 	if (!sess) {
 		uint8_t *s_id = NULL;
 		uint16_t loop_id = 0;
-- 
1.7.8.3

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux