Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b5292bc authored by Quinn Tran's avatar Quinn Tran Committed by Martin K. Petersen
Browse files

scsi: qla2xxx: Fix Relogin to prevent modifying scan_state flag



Relogin fails to move forward due to scan_state flag indicating device is
not there. Before relogin process, Session delete process accidently
modified the scan_state flag.

[mkp: typos plus corrected Fixes: sha as reported by sfr]

Fixes: 2dee5521 ("scsi: qla2xxx: Fix login state machine freeze")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarQuinn Tran <qutran@marvell.com>
Signed-off-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 7f4374e6
Loading
Loading
Loading
Loading
+20 −5
Original line number Original line Diff line number Diff line
@@ -303,8 +303,13 @@ qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport,
	struct srb_iocb *lio;
	struct srb_iocb *lio;
	int rval = QLA_FUNCTION_FAILED;
	int rval = QLA_FUNCTION_FAILED;


	if (!vha->flags.online)
	if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT) ||
		goto done;
	    fcport->loop_id == FC_NO_LOOP_ID) {
		ql_log(ql_log_warn, vha, 0xffff,
		    "%s: %8phC - not sending command.\n",
		    __func__, fcport->port_name);
		return rval;
	}


	sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL);
	sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL);
	if (!sp)
	if (!sp)
@@ -1276,8 +1281,13 @@ int qla24xx_async_gpdb(struct scsi_qla_host *vha, fc_port_t *fcport, u8 opt)
	struct port_database_24xx *pd;
	struct port_database_24xx *pd;
	struct qla_hw_data *ha = vha->hw;
	struct qla_hw_data *ha = vha->hw;


	if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT))
	if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT) ||
	    fcport->loop_id == FC_NO_LOOP_ID) {
		ql_log(ql_log_warn, vha, 0xffff,
		    "%s: %8phC - not sending command.\n",
		    __func__, fcport->port_name);
		return rval;
		return rval;
	}


	fcport->disc_state = DSC_GPDB;
	fcport->disc_state = DSC_GPDB;


@@ -1967,8 +1977,11 @@ qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha, struct event_arg *ea)
		return;
		return;
	}
	}


	if (fcport->disc_state == DSC_DELETE_PEND)
	if ((fcport->disc_state == DSC_DELETE_PEND) ||
	    (fcport->disc_state == DSC_DELETED)) {
		set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
		return;
		return;
	}


	if (ea->sp->gen2 != fcport->login_gen) {
	if (ea->sp->gen2 != fcport->login_gen) {
		/* target side must have changed it. */
		/* target side must have changed it. */
@@ -6712,8 +6725,10 @@ qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha)
	}
	}


	/* Clear all async request states across all VPs. */
	/* Clear all async request states across all VPs. */
	list_for_each_entry(fcport, &vha->vp_fcports, list)
	list_for_each_entry(fcport, &vha->vp_fcports, list) {
		fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT);
		fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT);
		fcport->scan_state = 0;
	}
	spin_lock_irqsave(&ha->vport_slock, flags);
	spin_lock_irqsave(&ha->vport_slock, flags);
	list_for_each_entry(vp, &ha->vp_list, list) {
	list_for_each_entry(vp, &ha->vp_list, list) {
		atomic_inc(&vp->vref_count);
		atomic_inc(&vp->vref_count);
+1 −0
Original line number Original line Diff line number Diff line
@@ -5085,6 +5085,7 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e)
	if (fcport) {
	if (fcport) {
		fcport->id_changed = 1;
		fcport->id_changed = 1;
		fcport->scan_state = QLA_FCPORT_FOUND;
		fcport->scan_state = QLA_FCPORT_FOUND;
		fcport->chip_reset = vha->hw->base_qpair->chip_reset;
		memcpy(fcport->node_name, e->u.new_sess.node_name, WWN_SIZE);
		memcpy(fcport->node_name, e->u.new_sess.node_name, WWN_SIZE);


		if (pla) {
		if (pla) {
+0 −1
Original line number Original line Diff line number Diff line
@@ -1209,7 +1209,6 @@ static void qla24xx_chk_fcp_state(struct fc_port *sess)
		sess->logout_on_delete = 0;
		sess->logout_on_delete = 0;
		sess->logo_ack_needed = 0;
		sess->logo_ack_needed = 0;
		sess->fw_login_state = DSC_LS_PORT_UNAVAIL;
		sess->fw_login_state = DSC_LS_PORT_UNAVAIL;
		sess->scan_state = 0;
	}
	}
}
}