aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorArmen Baloyan <armen.baloyan@qlogic.com>2012-11-21 02:39:53 -0500
committerJames Bottomley <JBottomley@Parallels.com>2012-11-30 04:34:44 -0500
commit63ea923a97cb0d78efcbbd229950e101588f0ddb (patch)
tree604d6893f8a91b7ff228f2d56d6d2c8a9a6b5025 /drivers/scsi
parent691e3d3175daff73d9b1771bf79ab032fdcec5a5 (diff)
[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: Steve Hodgson <steve@purestorage.com> Signed-off-by: Armen Baloyan <armen.baloyan@qlogic.com> Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com> Cc: <stable@vger.kernel.org> #3.7 Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/qla2xxx/qla_bsg.c65
1 files changed, 24 insertions, 41 deletions
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 2f9bddd3c616..05520be511b6 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -219,7 +219,8 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job)
219 break; 219 break;
220 } 220 }
221exit_fcp_prio_cfg: 221exit_fcp_prio_cfg:
222 bsg_job->job_done(bsg_job); 222 if (!ret)
223 bsg_job->job_done(bsg_job);
223 return ret; 224 return ret;
224} 225}
225 226
@@ -741,7 +742,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
741 if (qla81xx_get_port_config(vha, config)) { 742 if (qla81xx_get_port_config(vha, config)) {
742 ql_log(ql_log_warn, vha, 0x701f, 743 ql_log(ql_log_warn, vha, 0x701f,
743 "Get port config failed.\n"); 744 "Get port config failed.\n");
744 bsg_job->reply->result = (DID_ERROR << 16);
745 rval = -EPERM; 745 rval = -EPERM;
746 goto done_free_dma_req; 746 goto done_free_dma_req;
747 } 747 }
@@ -761,7 +761,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
761 new_config, elreq.options); 761 new_config, elreq.options);
762 762
763 if (rval) { 763 if (rval) {
764 bsg_job->reply->result = (DID_ERROR << 16);
765 rval = -EPERM; 764 rval = -EPERM;
766 goto done_free_dma_req; 765 goto done_free_dma_req;
767 } 766 }
@@ -795,7 +794,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
795 "MPI reset failed.\n"); 794 "MPI reset failed.\n");
796 } 795 }
797 796
798 bsg_job->reply->result = (DID_ERROR << 16);
799 rval = -EIO; 797 rval = -EIO;
800 goto done_free_dma_req; 798 goto done_free_dma_req;
801 } 799 }
@@ -812,33 +810,25 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
812 ql_log(ql_log_warn, vha, 0x702c, 810 ql_log(ql_log_warn, vha, 0x702c,
813 "Vendor request %s failed.\n", type); 811 "Vendor request %s failed.\n", type);
814 812
815 fw_sts_ptr = ((uint8_t *)bsg_job->req->sense) +
816 sizeof(struct fc_bsg_reply);
817
818 memcpy(fw_sts_ptr, response, sizeof(response));
819 fw_sts_ptr += sizeof(response);
820 *fw_sts_ptr = command_sent;
821 rval = 0; 813 rval = 0;
822 bsg_job->reply->result = (DID_ERROR << 16); 814 bsg_job->reply->result = (DID_ERROR << 16);
815 bsg_job->reply->reply_payload_rcv_len = 0;
823 } else { 816 } else {
824 ql_dbg(ql_dbg_user, vha, 0x702d, 817 ql_dbg(ql_dbg_user, vha, 0x702d,
825 "Vendor request %s completed.\n", type); 818 "Vendor request %s completed.\n", type);
826 819 bsg_job->reply->result = (DID_OK << 16);
827 bsg_job->reply_len = sizeof(struct fc_bsg_reply) +
828 sizeof(response) + sizeof(uint8_t);
829 bsg_job->reply->reply_payload_rcv_len =
830 bsg_job->reply_payload.payload_len;
831 fw_sts_ptr = ((uint8_t *)bsg_job->req->sense) +
832 sizeof(struct fc_bsg_reply);
833 memcpy(fw_sts_ptr, response, sizeof(response));
834 fw_sts_ptr += sizeof(response);
835 *fw_sts_ptr = command_sent;
836 bsg_job->reply->result = DID_OK;
837 sg_copy_from_buffer(bsg_job->reply_payload.sg_list, 820 sg_copy_from_buffer(bsg_job->reply_payload.sg_list,
838 bsg_job->reply_payload.sg_cnt, rsp_data, 821 bsg_job->reply_payload.sg_cnt, rsp_data,
839 rsp_data_len); 822 rsp_data_len);
840 } 823 }
841 bsg_job->job_done(bsg_job); 824
825 bsg_job->reply_len = sizeof(struct fc_bsg_reply) +
826 sizeof(response) + sizeof(uint8_t);
827 fw_sts_ptr = ((uint8_t *)bsg_job->req->sense) +
828 sizeof(struct fc_bsg_reply);
829 memcpy(fw_sts_ptr, response, sizeof(response));
830 fw_sts_ptr += sizeof(response);
831 *fw_sts_ptr = command_sent;
842 832
843 dma_free_coherent(&ha->pdev->dev, rsp_data_len, 833 dma_free_coherent(&ha->pdev->dev, rsp_data_len,
844 rsp_data, rsp_data_dma); 834 rsp_data, rsp_data_dma);
@@ -853,6 +843,8 @@ done_unmap_req_sg:
853 dma_unmap_sg(&ha->pdev->dev, 843 dma_unmap_sg(&ha->pdev->dev,
854 bsg_job->request_payload.sg_list, 844 bsg_job->request_payload.sg_list,
855 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); 845 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
846 if (!rval)
847 bsg_job->job_done(bsg_job);
856 return rval; 848 return rval;
857} 849}
858 850
@@ -877,16 +869,15 @@ qla84xx_reset(struct fc_bsg_job *bsg_job)
877 if (rval) { 869 if (rval) {
878 ql_log(ql_log_warn, vha, 0x7030, 870 ql_log(ql_log_warn, vha, 0x7030,
879 "Vendor request 84xx reset failed.\n"); 871 "Vendor request 84xx reset failed.\n");
880 rval = 0; 872 rval = (DID_ERROR << 16);
881 bsg_job->reply->result = (DID_ERROR << 16);
882 873
883 } else { 874 } else {
884 ql_dbg(ql_dbg_user, vha, 0x7031, 875 ql_dbg(ql_dbg_user, vha, 0x7031,
885 "Vendor request 84xx reset completed.\n"); 876 "Vendor request 84xx reset completed.\n");
886 bsg_job->reply->result = DID_OK; 877 bsg_job->reply->result = DID_OK;
878 bsg_job->job_done(bsg_job);
887 } 879 }
888 880
889 bsg_job->job_done(bsg_job);
890 return rval; 881 return rval;
891} 882}
892 883
@@ -976,8 +967,7 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job)
976 ql_log(ql_log_warn, vha, 0x7037, 967 ql_log(ql_log_warn, vha, 0x7037,
977 "Vendor request 84xx updatefw failed.\n"); 968 "Vendor request 84xx updatefw failed.\n");
978 969
979 rval = 0; 970 rval = (DID_ERROR << 16);
980 bsg_job->reply->result = (DID_ERROR << 16);
981 } else { 971 } else {
982 ql_dbg(ql_dbg_user, vha, 0x7038, 972 ql_dbg(ql_dbg_user, vha, 0x7038,
983 "Vendor request 84xx updatefw completed.\n"); 973 "Vendor request 84xx updatefw completed.\n");
@@ -986,7 +976,6 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job)
986 bsg_job->reply->result = DID_OK; 976 bsg_job->reply->result = DID_OK;
987 } 977 }
988 978
989 bsg_job->job_done(bsg_job);
990 dma_pool_free(ha->s_dma_pool, mn, mn_dma); 979 dma_pool_free(ha->s_dma_pool, mn, mn_dma);
991 980
992done_free_fw_buf: 981done_free_fw_buf:
@@ -996,6 +985,8 @@ done_unmap_sg:
996 dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, 985 dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list,
997 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); 986 bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
998 987
988 if (!rval)
989 bsg_job->job_done(bsg_job);
999 return rval; 990 return rval;
1000} 991}
1001 992
@@ -1163,8 +1154,7 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job)
1163 ql_log(ql_log_warn, vha, 0x7043, 1154 ql_log(ql_log_warn, vha, 0x7043,
1164 "Vendor request 84xx mgmt failed.\n"); 1155 "Vendor request 84xx mgmt failed.\n");
1165 1156
1166 rval = 0; 1157 rval = (DID_ERROR << 16);
1167 bsg_job->reply->result = (DID_ERROR << 16);
1168 1158
1169 } else { 1159 } else {
1170 ql_dbg(ql_dbg_user, vha, 0x7044, 1160 ql_dbg(ql_dbg_user, vha, 0x7044,
@@ -1184,8 +1174,6 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job)
1184 } 1174 }
1185 } 1175 }
1186 1176
1187 bsg_job->job_done(bsg_job);
1188
1189done_unmap_sg: 1177done_unmap_sg:
1190 if (mgmt_b) 1178 if (mgmt_b)
1191 dma_free_coherent(&ha->pdev->dev, data_len, mgmt_b, mgmt_dma); 1179 dma_free_coherent(&ha->pdev->dev, data_len, mgmt_b, mgmt_dma);
@@ -1200,6 +1188,8 @@ done_unmap_sg:
1200exit_mgmt: 1188exit_mgmt:
1201 dma_pool_free(ha->s_dma_pool, mn, mn_dma); 1189 dma_pool_free(ha->s_dma_pool, mn, mn_dma);
1202 1190
1191 if (!rval)
1192 bsg_job->job_done(bsg_job);
1203 return rval; 1193 return rval;
1204} 1194}
1205 1195
@@ -1276,9 +1266,7 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job)
1276 fcport->port_name[3], fcport->port_name[4], 1266 fcport->port_name[3], fcport->port_name[4],
1277 fcport->port_name[5], fcport->port_name[6], 1267 fcport->port_name[5], fcport->port_name[6],
1278 fcport->port_name[7], rval, fcport->fp_speed, mb[0], mb[1]); 1268 fcport->port_name[7], rval, fcport->fp_speed, mb[0], mb[1]);
1279 rval = 0; 1269 rval = (DID_ERROR << 16);
1280 bsg_job->reply->result = (DID_ERROR << 16);
1281
1282 } else { 1270 } else {
1283 if (!port_param->mode) { 1271 if (!port_param->mode) {
1284 bsg_job->reply_len = sizeof(struct fc_bsg_reply) + 1272 bsg_job->reply_len = sizeof(struct fc_bsg_reply) +
@@ -1292,9 +1280,9 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job)
1292 } 1280 }
1293 1281
1294 bsg_job->reply->result = DID_OK; 1282 bsg_job->reply->result = DID_OK;
1283 bsg_job->job_done(bsg_job);
1295 } 1284 }
1296 1285
1297 bsg_job->job_done(bsg_job);
1298 return rval; 1286 return rval;
1299} 1287}
1300 1288
@@ -1887,8 +1875,6 @@ qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job)
1887 return qla24xx_process_bidir_cmd(bsg_job); 1875 return qla24xx_process_bidir_cmd(bsg_job);
1888 1876
1889 default: 1877 default:
1890 bsg_job->reply->result = (DID_ERROR << 16);
1891 bsg_job->job_done(bsg_job);
1892 return -ENOSYS; 1878 return -ENOSYS;
1893 } 1879 }
1894} 1880}
@@ -1919,8 +1905,6 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job)
1919 ql_dbg(ql_dbg_user, vha, 0x709f, 1905 ql_dbg(ql_dbg_user, vha, 0x709f,
1920 "BSG: ISP abort active/needed -- cmd=%d.\n", 1906 "BSG: ISP abort active/needed -- cmd=%d.\n",
1921 bsg_job->request->msgcode); 1907 bsg_job->request->msgcode);
1922 bsg_job->reply->result = (DID_ERROR << 16);
1923 bsg_job->job_done(bsg_job);
1924 return -EBUSY; 1908 return -EBUSY;
1925 } 1909 }
1926 1910
@@ -1943,7 +1927,6 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job)
1943 case FC_BSG_RPT_CT: 1927 case FC_BSG_RPT_CT:
1944 default: 1928 default:
1945 ql_log(ql_log_warn, vha, 0x705a, "Unsupported BSG request.\n"); 1929 ql_log(ql_log_warn, vha, 0x705a, "Unsupported BSG request.\n");
1946 bsg_job->reply->result = ret;
1947 break; 1930 break;
1948 } 1931 }
1949 return ret; 1932 return ret;