Commit 0c227dc2 authored by Shreyas Deodhar's avatar Shreyas Deodhar Committed by Martin K. Petersen

scsi: qla2xxx: Check if port is online before sending ELS

CT Ping and ELS cmds fail for NVMe targets.  Check if port is online before
sending ELS instead of sending login.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarShreyas Deodhar <sdeodhar@marvell.com>
Signed-off-by: default avatarNilesh Javali <njavali@marvell.com>
Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 2d95c6de
...@@ -278,8 +278,8 @@ qla2x00_process_els(struct bsg_job *bsg_job) ...@@ -278,8 +278,8 @@ qla2x00_process_els(struct bsg_job *bsg_job)
const char *type; const char *type;
int req_sg_cnt, rsp_sg_cnt; int req_sg_cnt, rsp_sg_cnt;
int rval = (DID_ERROR << 16); int rval = (DID_ERROR << 16);
uint16_t nextlid = 0;
uint32_t els_cmd = 0; uint32_t els_cmd = 0;
int qla_port_allocated = 0;
if (bsg_request->msgcode == FC_BSG_RPT_ELS) { if (bsg_request->msgcode == FC_BSG_RPT_ELS) {
rport = fc_bsg_to_rport(bsg_job); rport = fc_bsg_to_rport(bsg_job);
...@@ -329,9 +329,9 @@ qla2x00_process_els(struct bsg_job *bsg_job) ...@@ -329,9 +329,9 @@ qla2x00_process_els(struct bsg_job *bsg_job)
/* make sure the rport is logged in, /* make sure the rport is logged in,
* if not perform fabric login * if not perform fabric login
*/ */
if (qla2x00_fabric_login(vha, fcport, &nextlid)) { if (atomic_read(&fcport->state) != FCS_ONLINE) {
ql_dbg(ql_dbg_user, vha, 0x7003, ql_dbg(ql_dbg_user, vha, 0x7003,
"Failed to login port %06X for ELS passthru.\n", "Port %06X is not online for ELS passthru.\n",
fcport->d_id.b24); fcport->d_id.b24);
rval = -EIO; rval = -EIO;
goto done; goto done;
...@@ -348,6 +348,7 @@ qla2x00_process_els(struct bsg_job *bsg_job) ...@@ -348,6 +348,7 @@ qla2x00_process_els(struct bsg_job *bsg_job)
goto done; goto done;
} }
qla_port_allocated = 1;
/* Initialize all required fields of fcport */ /* Initialize all required fields of fcport */
fcport->vha = vha; fcport->vha = vha;
fcport->d_id.b.al_pa = fcport->d_id.b.al_pa =
...@@ -432,7 +433,7 @@ qla2x00_process_els(struct bsg_job *bsg_job) ...@@ -432,7 +433,7 @@ qla2x00_process_els(struct bsg_job *bsg_job)
goto done_free_fcport; goto done_free_fcport;
done_free_fcport: done_free_fcport:
if (bsg_request->msgcode != FC_BSG_RPT_ELS) if (qla_port_allocated)
qla2x00_free_fcport(fcport); qla2x00_free_fcport(fcport);
done: done:
return rval; return rval;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment