virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Asias He <asias@redhat.com>
To: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
	virtualization@lists.linux-foundation.org,
	target-devel@vger.kernel.org,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: [PATCH 2/2] tcm_vhost: Wait for pending requests in vhost_scsi_clear_endpoint()
Date: Mon, 11 Mar 2013 13:09:39 +0800	[thread overview]
Message-ID: <1362978579-13322-3-git-send-email-asias@redhat.com> (raw)
In-Reply-To: <1362978579-13322-1-git-send-email-asias@redhat.com>

Wait for termination of all pending requests in clear endpoint
operation, otherwise you cannot reset virtio devices safely.

Signed-off-by: Asias He <asias@redhat.com>
---
 drivers/vhost/tcm_vhost.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c
index 5f8342c..4b0cb12 100644
--- a/drivers/vhost/tcm_vhost.c
+++ b/drivers/vhost/tcm_vhost.c
@@ -1152,9 +1152,13 @@ static int vhost_scsi_clear_endpoint(
 		tv_tpg->tv_tpg_vhost_count--;
 		tv_tpg->vhost_scsi = NULL;
 		vs->vs_tpg[target] = NULL;
+		/* After this, no further requests can be queued */
 		vs->vs_endpoint = false;
 		mutex_unlock(&tv_tpg->tv_tpg_mutex);
 	}
+	/* Flush the pending requests and wait for them to finish */
+	vhost_scsi_flush(vs);
+
 	mutex_unlock(&vs->dev.mutex);
 	return 0;
 
-- 
1.8.1.4

      parent reply	other threads:[~2013-03-11  5:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1362978579-13322-1-git-send-email-asias@redhat.com>
2013-03-11  5:09 ` [PATCH 1/2] tcm_vhost: Wait for pending requests in vhost_scsi_flush() Asias He
2013-03-11 11:36   ` Paolo Bonzini
2013-03-11 11:53     ` Michael S. Tsirkin
2013-03-11 12:15       ` Paolo Bonzini
2013-03-12  1:34       ` Asias He
2013-03-12  1:31     ` Asias He
2013-03-12  8:21       ` Paolo Bonzini
2013-03-13  5:16         ` Asias He
2013-03-19  2:03           ` Asias He
2013-03-11  5:09 ` Asias He [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1362978579-13322-3-git-send-email-asias@redhat.com \
    --to=asias@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=nab@linux-iscsi.org \
    --cc=pbonzini@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=target-devel@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).