From: Asias He Subject: [PATCH V2 2/3] tcm_vhost: Wait for pending requests in vhost_scsi_clear_endpoint() Date: Fri, 22 Mar 2013 14:55:28 +0800 Message-ID: <1363935329-11796-3-git-send-email-asias@redhat.com> References: <1363935329-11796-1-git-send-email-asias@redhat.com> Cc: Paolo Bonzini , Stefan Hajnoczi , "Michael S. Tsirkin" , Rusty Russell , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, target-devel@vger.kernel.org, Asias He To: Nicholas Bellinger Return-path: Received: from mx1.redhat.com ([209.132.183.28]:54905 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932856Ab3CVGzt (ORCPT ); Fri, 22 Mar 2013 02:55:49 -0400 In-Reply-To: <1363935329-11796-1-git-send-email-asias@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Wait for termination of all pending requests in clear endpoint operation, otherwise you cannot reset virtio devices safely. Signed-off-by: Asias He --- drivers/vhost/tcm_vhost.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c index dc0af52..f57e5ba 100644 --- a/drivers/vhost/tcm_vhost.c +++ b/drivers/vhost/tcm_vhost.c @@ -1174,6 +1174,9 @@ static int vhost_scsi_clear_endpoint( mutex_unlock(&vq->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