diff options
author | Asias He <asias@redhat.com> | 2013-04-26 23:16:49 -0400 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2013-05-01 03:02:51 -0400 |
commit | f2f0173d6a95fa60e7934f62ce27d6bd24e4e09c (patch) | |
tree | 9b875c3e325d3cdc6c0ddd0cfa198e8e6deff9b0 /drivers/vhost/tcm_vhost.h | |
parent | 3ab2e420ec1caf4ead233f3161ac7d86fe5d2a9f (diff) |
tcm_vhost: Wait for pending requests in vhost_scsi_flush()
Unlike tcm_vhost_evt requests, tcm_vhost_cmd requests are passed to the
target core system, we can not make sure all the pending requests will
be finished by flushing the virt queue.
In this patch, we do refcount for every tcm_vhost_cmd requests to make
vhost_scsi_flush() wait for all the pending requests issued before the
flush operation to be finished.
This is useful when we call vhost_scsi_clear_endpoint() to stop
tcm_vhost. No new requests will be passed to target core system because
we clear the endpoint by setting vs_tpg to NULL. And we wait for all the
old requests. These guarantee no requests will be leaked and existing
requests will be completed.
Signed-off-by: Asias He <asias@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost/tcm_vhost.h')
-rw-r--r-- | drivers/vhost/tcm_vhost.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/vhost/tcm_vhost.h b/drivers/vhost/tcm_vhost.h index 514b9fda230e..26a57c2fdf92 100644 --- a/drivers/vhost/tcm_vhost.h +++ b/drivers/vhost/tcm_vhost.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define TCM_VHOST_NAMELEN 256 | 2 | #define TCM_VHOST_NAMELEN 256 |
3 | #define TCM_VHOST_MAX_CDB_SIZE 32 | 3 | #define TCM_VHOST_MAX_CDB_SIZE 32 |
4 | 4 | ||
5 | struct vhost_scsi_inflight; | ||
5 | struct tcm_vhost_cmd { | 6 | struct tcm_vhost_cmd { |
6 | /* Descriptor from vhost_get_vq_desc() for virt_queue segment */ | 7 | /* Descriptor from vhost_get_vq_desc() for virt_queue segment */ |
7 | int tvc_vq_desc; | 8 | int tvc_vq_desc; |
@@ -37,6 +38,8 @@ struct tcm_vhost_cmd { | |||
37 | unsigned char tvc_sense_buf[TRANSPORT_SENSE_BUFFER]; | 38 | unsigned char tvc_sense_buf[TRANSPORT_SENSE_BUFFER]; |
38 | /* Completed commands list, serviced from vhost worker thread */ | 39 | /* Completed commands list, serviced from vhost worker thread */ |
39 | struct llist_node tvc_completion_list; | 40 | struct llist_node tvc_completion_list; |
41 | /* Used to track inflight cmd */ | ||
42 | struct vhost_scsi_inflight *inflight; | ||
40 | }; | 43 | }; |
41 | 44 | ||
42 | struct tcm_vhost_nexus { | 45 | struct tcm_vhost_nexus { |