]> git.baikalelectronics.ru Git - kernel.git/commit
tcm_vhost: Wait for pending requests in vhost_scsi_flush()
authorAsias He <asias@redhat.com>
Sat, 27 Apr 2013 03:16:49 +0000 (11:16 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 1 May 2013 07:02:51 +0000 (10:02 +0300)
commit10a3f8be7c2785f33009ba0737cd05bf18f74de5
tree9b875c3e325d3cdc6c0ddd0cfa198e8e6deff9b0
parente6327758095a3891ad24911a580d2593edac10dd
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>
drivers/vhost/tcm_vhost.c
drivers/vhost/tcm_vhost.h