Skip to content

Commit b4fffc1

Browse files
mikechristiemstsirkin
authored andcommitted
vhost scsi: fix lun reset completion handling
vhost scsi owns the scsi se_cmd but lio frees the se_cmd->se_tmr before calling release_cmd, so while with normal cmd completion we can access the se_cmd from the vhost work, we can't do the same with se_cmd->se_tmr. This has us copy the tmf response in vhost_scsi_queue_tm_rsp to our internal vhost-scsi tmf struct for when it gets sent to the guest from our worker thread. Fixes: efd838f ("vhost scsi: Add support for LUN resets.") Signed-off-by: Mike Christie <michael.christie@oracle.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Link: https://lore.kernel.org/r/1605887459-3864-1-git-send-email-michael.christie@oracle.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
1 parent 418baf2 commit b4fffc1

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/vhost/scsi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ struct vhost_scsi_tmf {
220220
struct list_head queue_entry;
221221

222222
struct se_cmd se_cmd;
223+
u8 scsi_resp;
223224
struct vhost_scsi_inflight *inflight;
224225
struct iovec resp_iov;
225226
int in_iovs;
@@ -426,6 +427,7 @@ static void vhost_scsi_queue_tm_rsp(struct se_cmd *se_cmd)
426427
struct vhost_scsi_tmf *tmf = container_of(se_cmd, struct vhost_scsi_tmf,
427428
se_cmd);
428429

430+
tmf->scsi_resp = se_cmd->se_tmr_req->response;
429431
transport_generic_free_cmd(&tmf->se_cmd, 0);
430432
}
431433

@@ -1183,7 +1185,7 @@ static void vhost_scsi_tmf_resp_work(struct vhost_work *work)
11831185
vwork);
11841186
int resp_code;
11851187

1186-
if (tmf->se_cmd.se_tmr_req->response == TMR_FUNCTION_COMPLETE)
1188+
if (tmf->scsi_resp == TMR_FUNCTION_COMPLETE)
11871189
resp_code = VIRTIO_SCSI_S_FUNCTION_SUCCEEDED;
11881190
else
11891191
resp_code = VIRTIO_SCSI_S_FUNCTION_REJECTED;

0 commit comments

Comments
 (0)