aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2014-12-21 13:42:08 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2015-01-06 16:46:29 -0500
commit46243860806bdc2756f3ce8ac86b4d7c616bcd6c (patch)
tree9f3566128019cb222ed2dbb6ba730aa356bc750b
parent97bf6af1f928216fd6c5a66e8a57bfa95a659672 (diff)
vhost-scsi: Add missing virtio-scsi -> TCM attribute conversion
While looking at hch's recent conversion to drop the MSG_*_TAG definitions, I noticed a long standing bug in vhost-scsi where the VIRTIO_SCSI_S_* attribute definitions where incorrectly being passed directly into target_submit_cmd_map_sgls(). This patch adds the missing virtio-scsi to TCM/SAM task attribute conversion. Cc: Christoph Hellwig <hch@lst.de> Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: stable@vger.kernel.org # 3.5 Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/vhost/scsi.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 01c01cb3933f..d695b1673ae5 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -911,6 +911,23 @@ vhost_scsi_map_iov_to_prot(struct tcm_vhost_cmd *cmd,
911 return 0; 911 return 0;
912} 912}
913 913
914static int vhost_scsi_to_tcm_attr(int attr)
915{
916 switch (attr) {
917 case VIRTIO_SCSI_S_SIMPLE:
918 return TCM_SIMPLE_TAG;
919 case VIRTIO_SCSI_S_ORDERED:
920 return TCM_ORDERED_TAG;
921 case VIRTIO_SCSI_S_HEAD:
922 return TCM_HEAD_TAG;
923 case VIRTIO_SCSI_S_ACA:
924 return TCM_ACA_TAG;
925 default:
926 break;
927 }
928 return TCM_SIMPLE_TAG;
929}
930
914static void tcm_vhost_submission_work(struct work_struct *work) 931static void tcm_vhost_submission_work(struct work_struct *work)
915{ 932{
916 struct tcm_vhost_cmd *cmd = 933 struct tcm_vhost_cmd *cmd =
@@ -936,9 +953,10 @@ static void tcm_vhost_submission_work(struct work_struct *work)
936 rc = target_submit_cmd_map_sgls(se_cmd, tv_nexus->tvn_se_sess, 953 rc = target_submit_cmd_map_sgls(se_cmd, tv_nexus->tvn_se_sess,
937 cmd->tvc_cdb, &cmd->tvc_sense_buf[0], 954 cmd->tvc_cdb, &cmd->tvc_sense_buf[0],
938 cmd->tvc_lun, cmd->tvc_exp_data_len, 955 cmd->tvc_lun, cmd->tvc_exp_data_len,
939 cmd->tvc_task_attr, cmd->tvc_data_direction, 956 vhost_scsi_to_tcm_attr(cmd->tvc_task_attr),
940 TARGET_SCF_ACK_KREF, sg_ptr, cmd->tvc_sgl_count, 957 cmd->tvc_data_direction, TARGET_SCF_ACK_KREF,
941 NULL, 0, sg_prot_ptr, cmd->tvc_prot_sgl_count); 958 sg_ptr, cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr,
959 cmd->tvc_prot_sgl_count);
942 if (rc < 0) { 960 if (rc < 0) {
943 transport_send_check_condition_and_sense(se_cmd, 961 transport_send_check_condition_and_sense(se_cmd,
944 TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); 962 TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0);