Commit 63ea923a authored by Armen Baloyan's avatar Armen Baloyan Committed by James Bottomley

[SCSI] qla2xxx: Properly set result field of bsg_job reply structure for success and failure.

FC transport on receiving bsg_job submission failure, calls bsg_job->job_done()
and sets the bsg_job->reply->result the returned value. In contrast, when the
success code (0) is returned fc transport doesn't call bsg_job->job_done() and
doesn't populate bsg_job->reply->result.
Signed-off-by: default avatarSteve Hodgson <steve@purestorage.com>
Signed-off-by: default avatarArmen Baloyan <armen.baloyan@qlogic.com>
Signed-off-by: default avatarSaurav Kashyap <saurav.kashyap@qlogic.com>
Cc: <stable@vger.kernel.org> #3.7
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 691e3d31
...@@ -219,7 +219,8 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job) ...@@ -219,7 +219,8 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job)
break; break;
} }
exit_fcp_prio_cfg: exit_fcp_prio_cfg:
bsg_job->job_done(bsg_job); if (!ret)
bsg_job->job_done(bsg_job);
return ret; return ret;
} }
...@@ -741,7 +742,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) ...@@ -741,7 +742,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
if (qla81xx_get_port_config(vha, config)) { if (qla81xx_get_port_config(vha, config)) {
ql_log(ql_log_warn, vha, 0x701f, ql_log(ql_log_warn, vha, 0x701f,
"Get port config failed.\n"); "Get port config failed.\n");
bsg_job->reply->result = (DID_ERROR << 16);
rval = -EPERM; rval = -EPERM;
goto done_free_dma_req; goto done_free_dma_req;
} }
...@@ -761,7 +761,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) ...@@ -761,7 +761,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
new_config, elreq.options); new_config, elreq.options);
if (rval) { if (rval) {
bsg_job->reply->result = (DID_ERROR << 16);
rval = -EPERM; rval = -EPERM;
goto done_free_dma_req; goto done_free_dma_req;
} }
...@@ -795,7 +794,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) ...@@ -795,7 +794,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
"MPI reset failed.\n"); "MPI reset failed.\n");
} }
bsg_job->reply->result = (DID_ERROR << 16);
rval = -EIO; rval = -EIO;
goto done_free_dma_req; goto done_free_dma_req;
} }
...@@ -812,33 +810,25 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) ...@@ -812,33 +810,25 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
ql_log(ql_log_warn, vha, 0x702c, ql_log(ql_log_warn, vha, 0x702c,
"Vendor request %s failed.\n", type); "Vendor request %s failed.\n", type);
fw_sts_ptr = ((uint8_t *)bsg_job->req->sense) +
sizeof(struct fc_bsg_reply);
memcpy(fw_sts_ptr, response, sizeof(response));
fw_sts_ptr += sizeof(response);
*fw_sts_ptr = command_sent;
rval = 0; rval = 0;
bsg_job->reply->result = (DID_ERROR << 16); bsg_job->reply->result = (DID_ERROR << 16);
bsg_job->reply->reply_payload_rcv_len = 0;
} else { } else {
ql_dbg(ql_dbg_user, vha, 0x702d, ql_dbg(ql_dbg_user, vha, 0x702d,
"Vendor request %s completed.\n", type); "Vendor request %s completed.\n", type);
bsg_job->reply->result = (DID_OK << 16);
bsg_job->reply_len = sizeof(struct fc_bsg_reply) +
sizeof(response) + sizeof(uint8_t);
bsg_job->reply->reply_payload_rcv_len =
bsg_job->reply_payload.payload_len;
fw_sts_ptr = ((uint8_t *)bsg_job->req->sense) +
sizeof(struct fc_bsg_reply);
memcpy(fw_sts_ptr, response, sizeof(response));
fw_sts_ptr += sizeof(response);
*fw_sts_ptr = command_sent;
bsg_job->reply->result = DID_OK;
sg_copy_from_buffer(bsg_job->reply_payload.sg_list, sg_copy_from_buffer(bsg_job->reply_payload.sg_list,
bsg_job->reply_payload.sg_cnt, rsp_data, bsg_job->reply_payload.sg_cnt, rsp_data,
rsp_data_len); rsp_data_len);
} }
bsg_job->job_done(bsg_job);
bsg_job->reply_len = sizeof(struct fc_bsg_reply) +
sizeof(response) + sizeof(uint8_t);
fw_sts_ptr = ((uint8_t *)bsg_job->req->sense) +
sizeof(struct fc_bsg_reply);
memcpy(fw_sts_ptr, response, sizeof(response));
fw_sts_ptr += sizeof(response);
*fw_sts_ptr = command_sent;
dma_free_coherent(&ha->pdev->dev, rsp_data_len, dma_free_coherent(&ha->pdev->dev, rsp_data_len,
rsp_data, rsp_data_dma); rsp_data, rsp_data_dma);
...@@ -853,6 +843,8 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) ...@@ -853,6 +843,8 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
dma_unmap_sg(&ha->pdev->dev, dma_unmap_sg(&ha->pdev->dev,
bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_list,
bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
if (!rval)
bsg_job->job_done(bsg_job);
return rval; return rval;
} }
...@@ -877,16 +869,15 @@ qla84xx_reset(struct fc_bsg_job *bsg_job) ...@@ -877,16 +869,15 @@ qla84xx_reset(struct fc_bsg_job *bsg_job)
if (rval) { if (rval) {
ql_log(ql_log_warn, vha, 0x7030, ql_log(ql_log_warn, vha, 0x7030,
"Vendor request 84xx reset failed.\n"); "Vendor request 84xx reset failed.\n");
rval = 0; rval = (DID_ERROR << 16);
bsg_job->reply->result = (DID_ERROR << 16);
} else { } else {
ql_dbg(ql_dbg_user, vha, 0x7031, ql_dbg(ql_dbg_user, vha, 0x7031,
"Vendor request 84xx reset completed.\n"); "Vendor request 84xx reset completed.\n");
bsg_job->reply->result = DID_OK; bsg_job->reply->result = DID_OK;
bsg_job->job_done(bsg_job);
} }
bsg_job->job_done(bsg_job);
return rval; return rval;
} }
...@@ -976,8 +967,7 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job) ...@@ -976,8 +967,7 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job)
ql_log(ql_log_warn, vha, 0x7037, ql_log(ql_log_warn, vha, 0x7037,
"Vendor request 84xx updatefw failed.\n"); "Vendor request 84xx updatefw failed.\n");
rval = 0; rval = (DID_ERROR << 16);
bsg_job->reply->result = (DID_ERROR << 16);
} else { } else {
ql_dbg(ql_dbg_user, vha, 0x7038, ql_dbg(ql_dbg_user, vha, 0x7038,
"Vendor request 84xx updatefw completed.\n"); "Vendor request 84xx updatefw completed.\n");
...@@ -986,7 +976,6 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job) ...@@ -986,7 +976,6 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job)
bsg_job->reply->result = DID_OK; bsg_job->reply->result = DID_OK;
} }
bsg_job->job_done(bsg_job);
dma_pool_free(ha->s_dma_pool, mn, mn_dma); dma_pool_free(ha->s_dma_pool, mn, mn_dma);
done_free_fw_buf: done_free_fw_buf:
...@@ -996,6 +985,8 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job) ...@@ -996,6 +985,8 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job)
dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list,
bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
if (!rval)
bsg_job->job_done(bsg_job);
return rval; return rval;
} }
...@@ -1163,8 +1154,7 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) ...@@ -1163,8 +1154,7 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job)
ql_log(ql_log_warn, vha, 0x7043, ql_log(ql_log_warn, vha, 0x7043,
"Vendor request 84xx mgmt failed.\n"); "Vendor request 84xx mgmt failed.\n");
rval = 0; rval = (DID_ERROR << 16);
bsg_job->reply->result = (DID_ERROR << 16);
} else { } else {
ql_dbg(ql_dbg_user, vha, 0x7044, ql_dbg(ql_dbg_user, vha, 0x7044,
...@@ -1184,8 +1174,6 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) ...@@ -1184,8 +1174,6 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job)
} }
} }
bsg_job->job_done(bsg_job);
done_unmap_sg: done_unmap_sg:
if (mgmt_b) if (mgmt_b)
dma_free_coherent(&ha->pdev->dev, data_len, mgmt_b, mgmt_dma); dma_free_coherent(&ha->pdev->dev, data_len, mgmt_b, mgmt_dma);
...@@ -1200,6 +1188,8 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) ...@@ -1200,6 +1188,8 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job)
exit_mgmt: exit_mgmt:
dma_pool_free(ha->s_dma_pool, mn, mn_dma); dma_pool_free(ha->s_dma_pool, mn, mn_dma);
if (!rval)
bsg_job->job_done(bsg_job);
return rval; return rval;
} }
...@@ -1276,9 +1266,7 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job) ...@@ -1276,9 +1266,7 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job)
fcport->port_name[3], fcport->port_name[4], fcport->port_name[3], fcport->port_name[4],
fcport->port_name[5], fcport->port_name[6], fcport->port_name[5], fcport->port_name[6],
fcport->port_name[7], rval, fcport->fp_speed, mb[0], mb[1]); fcport->port_name[7], rval, fcport->fp_speed, mb[0], mb[1]);
rval = 0; rval = (DID_ERROR << 16);
bsg_job->reply->result = (DID_ERROR << 16);
} else { } else {
if (!port_param->mode) { if (!port_param->mode) {
bsg_job->reply_len = sizeof(struct fc_bsg_reply) + bsg_job->reply_len = sizeof(struct fc_bsg_reply) +
...@@ -1292,9 +1280,9 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job) ...@@ -1292,9 +1280,9 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job)
} }
bsg_job->reply->result = DID_OK; bsg_job->reply->result = DID_OK;
bsg_job->job_done(bsg_job);
} }
bsg_job->job_done(bsg_job);
return rval; return rval;
} }
...@@ -1887,8 +1875,6 @@ qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job) ...@@ -1887,8 +1875,6 @@ qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job)
return qla24xx_process_bidir_cmd(bsg_job); return qla24xx_process_bidir_cmd(bsg_job);
default: default:
bsg_job->reply->result = (DID_ERROR << 16);
bsg_job->job_done(bsg_job);
return -ENOSYS; return -ENOSYS;
} }
} }
...@@ -1919,8 +1905,6 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job) ...@@ -1919,8 +1905,6 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job)
ql_dbg(ql_dbg_user, vha, 0x709f, ql_dbg(ql_dbg_user, vha, 0x709f,
"BSG: ISP abort active/needed -- cmd=%d.\n", "BSG: ISP abort active/needed -- cmd=%d.\n",
bsg_job->request->msgcode); bsg_job->request->msgcode);
bsg_job->reply->result = (DID_ERROR << 16);
bsg_job->job_done(bsg_job);
return -EBUSY; return -EBUSY;
} }
...@@ -1943,7 +1927,6 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job) ...@@ -1943,7 +1927,6 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job)
case FC_BSG_RPT_CT: case FC_BSG_RPT_CT:
default: default:
ql_log(ql_log_warn, vha, 0x705a, "Unsupported BSG request.\n"); ql_log(ql_log_warn, vha, 0x705a, "Unsupported BSG request.\n");
bsg_job->reply->result = ret;
break; break;
} }
return ret; return ret;
......
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