* [PATCH] vhost-scsi: Add missing virtio-scsi -> TCM attribute conversion
@ 2015-01-06 20:18 Nicholas A. Bellinger
2015-01-06 21:07 ` Michael S. Tsirkin
2015-01-11 11:45 ` Christoph Hellwig
0 siblings, 2 replies; 4+ messages in thread
From: Nicholas A. Bellinger @ 2015-01-06 20:18 UTC (permalink / raw)
To: target-devel
Cc: linux-scsi, Nicholas Bellinger, Christoph Hellwig,
Michael S. Tsirkin, Paolo Bonzini
From: Nicholas Bellinger <nab@linux-iscsi.org>
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>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
---
drivers/vhost/scsi.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 01c01cb..d695b16 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,
return 0;
}
+static int vhost_scsi_to_tcm_attr(int attr)
+{
+ switch (attr) {
+ case VIRTIO_SCSI_S_SIMPLE:
+ return TCM_SIMPLE_TAG;
+ case VIRTIO_SCSI_S_ORDERED:
+ return TCM_ORDERED_TAG;
+ case VIRTIO_SCSI_S_HEAD:
+ return TCM_HEAD_TAG;
+ case VIRTIO_SCSI_S_ACA:
+ return TCM_ACA_TAG;
+ default:
+ break;
+ }
+ return TCM_SIMPLE_TAG;
+}
+
static void tcm_vhost_submission_work(struct work_struct *work)
{
struct tcm_vhost_cmd *cmd =
@@ -936,9 +953,10 @@ static void tcm_vhost_submission_work(struct work_struct *work)
rc = target_submit_cmd_map_sgls(se_cmd, tv_nexus->tvn_se_sess,
cmd->tvc_cdb, &cmd->tvc_sense_buf[0],
cmd->tvc_lun, cmd->tvc_exp_data_len,
- cmd->tvc_task_attr, cmd->tvc_data_direction,
- TARGET_SCF_ACK_KREF, sg_ptr, cmd->tvc_sgl_count,
- NULL, 0, sg_prot_ptr, cmd->tvc_prot_sgl_count);
+ vhost_scsi_to_tcm_attr(cmd->tvc_task_attr),
+ cmd->tvc_data_direction, TARGET_SCF_ACK_KREF,
+ sg_ptr, cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr,
+ cmd->tvc_prot_sgl_count);
if (rc < 0) {
transport_send_check_condition_and_sense(se_cmd,
TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0);
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] vhost-scsi: Add missing virtio-scsi -> TCM attribute conversion
2015-01-06 20:18 [PATCH] vhost-scsi: Add missing virtio-scsi -> TCM attribute conversion Nicholas A. Bellinger
@ 2015-01-06 21:07 ` Michael S. Tsirkin
2015-01-06 21:46 ` Nicholas A. Bellinger
2015-01-11 11:45 ` Christoph Hellwig
1 sibling, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2015-01-06 21:07 UTC (permalink / raw)
To: Nicholas A. Bellinger
Cc: target-devel, linux-scsi, Nicholas Bellinger, Christoph Hellwig,
Paolo Bonzini
On Tue, Jan 06, 2015 at 08:18:05PM +0000, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger <nab@linux-iscsi.org>
>
> 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>
> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Cc stable as well?
> ---
> drivers/vhost/scsi.c | 24 +++++++++++++++++++++---
> 1 file changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
> index 01c01cb..d695b16 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,
> return 0;
> }
>
> +static int vhost_scsi_to_tcm_attr(int attr)
> +{
> + switch (attr) {
> + case VIRTIO_SCSI_S_SIMPLE:
> + return TCM_SIMPLE_TAG;
> + case VIRTIO_SCSI_S_ORDERED:
> + return TCM_ORDERED_TAG;
> + case VIRTIO_SCSI_S_HEAD:
> + return TCM_HEAD_TAG;
> + case VIRTIO_SCSI_S_ACA:
> + return TCM_ACA_TAG;
> + default:
> + break;
> + }
> + return TCM_SIMPLE_TAG;
> +}
> +
> static void tcm_vhost_submission_work(struct work_struct *work)
> {
> struct tcm_vhost_cmd *cmd =
> @@ -936,9 +953,10 @@ static void tcm_vhost_submission_work(struct work_struct *work)
> rc = target_submit_cmd_map_sgls(se_cmd, tv_nexus->tvn_se_sess,
> cmd->tvc_cdb, &cmd->tvc_sense_buf[0],
> cmd->tvc_lun, cmd->tvc_exp_data_len,
> - cmd->tvc_task_attr, cmd->tvc_data_direction,
> - TARGET_SCF_ACK_KREF, sg_ptr, cmd->tvc_sgl_count,
> - NULL, 0, sg_prot_ptr, cmd->tvc_prot_sgl_count);
> + vhost_scsi_to_tcm_attr(cmd->tvc_task_attr),
> + cmd->tvc_data_direction, TARGET_SCF_ACK_KREF,
> + sg_ptr, cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr,
> + cmd->tvc_prot_sgl_count);
> if (rc < 0) {
> transport_send_check_condition_and_sense(se_cmd,
> TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0);
> --
> 1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] vhost-scsi: Add missing virtio-scsi -> TCM attribute conversion
2015-01-06 21:07 ` Michael S. Tsirkin
@ 2015-01-06 21:46 ` Nicholas A. Bellinger
0 siblings, 0 replies; 4+ messages in thread
From: Nicholas A. Bellinger @ 2015-01-06 21:46 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Nicholas A. Bellinger, target-devel, linux-scsi,
Christoph Hellwig, Paolo Bonzini
On Tue, 2015-01-06 at 23:07 +0200, Michael S. Tsirkin wrote:
> On Tue, Jan 06, 2015 at 08:18:05PM +0000, Nicholas A. Bellinger wrote:
> > From: Nicholas Bellinger <nab@linux-iscsi.org>
> >
> > 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>
> > Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
>
> Cc stable as well?
>
That makes sense here, but anything < v3.19-rc will need to use the old
MSG_*_TAG defines.
Will fix up that once Greg-KH complains about the compile failure(s).
--nab
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] vhost-scsi: Add missing virtio-scsi -> TCM attribute conversion
2015-01-06 20:18 [PATCH] vhost-scsi: Add missing virtio-scsi -> TCM attribute conversion Nicholas A. Bellinger
2015-01-06 21:07 ` Michael S. Tsirkin
@ 2015-01-11 11:45 ` Christoph Hellwig
1 sibling, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2015-01-11 11:45 UTC (permalink / raw)
To: Nicholas A. Bellinger
Cc: target-devel, linux-scsi, Nicholas Bellinger, Christoph Hellwig,
Michael S. Tsirkin, Paolo Bonzini
On Tue, Jan 06, 2015 at 08:18:05PM +0000, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger <nab@linux-iscsi.org>
>
> 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.
Btw, ehat is your plan on ordered tag handling in the target code?
It's fairly broken as it doesn't respect 100% ordering, and as far as I can
tell it's always been like that. Maybe it's better to not even advertise
it?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-01-11 11:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-06 20:18 [PATCH] vhost-scsi: Add missing virtio-scsi -> TCM attribute conversion Nicholas A. Bellinger
2015-01-06 21:07 ` Michael S. Tsirkin
2015-01-06 21:46 ` Nicholas A. Bellinger
2015-01-11 11:45 ` Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.