Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 362496
b: refs/heads/master
c: 637ab21
h: refs/heads/master
v: v3
  • Loading branch information
Asias He authored and Nicholas Bellinger committed Apr 11, 2013
1 parent e1a0a1e commit 3ccb5f7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7ea206cf3b06704cf2bfc9c9c395094b24dc44a2
refs/heads/master: 637ab21e284f4e9188acc2746695f7f6452b4a22
31 changes: 18 additions & 13 deletions trunk/drivers/vhost/tcm_vhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,23 @@ static void tcm_vhost_submission_work(struct work_struct *work)
}
}

static void vhost_scsi_send_bad_target(struct vhost_scsi *vs,
struct vhost_virtqueue *vq, int head, unsigned out)
{
struct virtio_scsi_cmd_resp __user *resp;
struct virtio_scsi_cmd_resp rsp;
int ret;

memset(&rsp, 0, sizeof(rsp));
rsp.response = VIRTIO_SCSI_S_BAD_TARGET;
resp = vq->iov[out].iov_base;
ret = __copy_to_user(resp, &rsp, sizeof(rsp));
if (!ret)
vhost_add_used_and_signal(&vs->dev, vq, head, 0);
else
pr_err("Faulted on virtio_scsi_cmd_resp\n");
}

static void vhost_scsi_handle_vq(struct vhost_scsi *vs,
struct vhost_virtqueue *vq)
{
Expand Down Expand Up @@ -673,19 +690,7 @@ static void vhost_scsi_handle_vq(struct vhost_scsi *vs,

/* Target does not exist, fail the request */
if (unlikely(!tv_tpg)) {
struct virtio_scsi_cmd_resp __user *resp;
struct virtio_scsi_cmd_resp rsp;

memset(&rsp, 0, sizeof(rsp));
rsp.response = VIRTIO_SCSI_S_BAD_TARGET;
resp = vq->iov[out].iov_base;
ret = __copy_to_user(resp, &rsp, sizeof(rsp));
if (!ret)
vhost_add_used_and_signal(&vs->dev,
vq, head, 0);
else
pr_err("Faulted on virtio_scsi_cmd_resp\n");

vhost_scsi_send_bad_target(vs, vq, head, out);
continue;
}

Expand Down

0 comments on commit 3ccb5f7

Please sign in to comment.