aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAsias He <asias@redhat.com>2013-04-03 02:17:38 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2013-04-08 17:09:54 -0400
commitdfd5d5692c7ddf27380511b80a3dc590acfc4eee (patch)
tree482d5438c0e3f9ca191ad8ce1b9f447c15ee72cf
parent4f7f46d32c9875004fae1d57ae3c02cc2e6cd6a3 (diff)
tcm_vhost: Initialize vq->last_used_idx when set endpoint
This patch fixes guest hang when booting seabios and guest. [ 0.576238] scsi0 : Virtio SCSI HBA [ 0.616754] virtio_scsi virtio1: request:id 0 is not a head! vq->last_used_idx is initialized only when /dev/vhost-scsi is opened or closed. vhost_scsi_open -> vhost_dev_init() -> vhost_vq_reset() vhost_scsi_release() -> vhost_dev_cleanup -> vhost_vq_reset() So, when guest talks to tcm_vhost after seabios does, vq->last_used_idx still contains the old valule for seabios. This confuses guest. Fix this by calling vhost_init_used() to init vq->last_used_idx when we set endpoint. Signed-off-by: Asias He <asias@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/vhost/tcm_vhost.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c
index 6cda137bb208..c127731b4230 100644
--- a/drivers/vhost/tcm_vhost.c
+++ b/drivers/vhost/tcm_vhost.c
@@ -874,6 +874,7 @@ static int vhost_scsi_set_endpoint(
874 /* Flushing the vhost_work acts as synchronize_rcu */ 874 /* Flushing the vhost_work acts as synchronize_rcu */
875 mutex_lock(&vq->mutex); 875 mutex_lock(&vq->mutex);
876 rcu_assign_pointer(vq->private_data, vs_tpg); 876 rcu_assign_pointer(vq->private_data, vs_tpg);
877 vhost_init_used(vq);
877 mutex_unlock(&vq->mutex); 878 mutex_unlock(&vq->mutex);
878 } 879 }
879 ret = 0; 880 ret = 0;