summaryrefslogtreecommitdiffstats
path: root/drivers/vhost/net.c
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2011-06-21 06:04:27 -0400
committerMichael S. Tsirkin <mst@redhat.com>2011-07-19 06:28:34 -0400
commitf59281dafb832b161133743fcf3dc29051e6fdb8 (patch)
tree3eacc9fd60396174a94c8bd02326e930ff94351d /drivers/vhost/net.c
parent81fc70d86527a1450560709500ca5f52e661da1f (diff)
vhost: init used ring after backend was set
Move the used ring initialization after backend was set. This makes it possible to disable the backend and tweak the used ring, then restart. This will also make it possible to log the used ring write correctly. Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost/net.c')
-rw-r--r--drivers/vhost/net.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index f0fd52cdfadc..70ac60437d17 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -703,6 +703,10 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
703 vhost_net_disable_vq(n, vq); 703 vhost_net_disable_vq(n, vq);
704 rcu_assign_pointer(vq->private_data, sock); 704 rcu_assign_pointer(vq->private_data, sock);
705 vhost_net_enable_vq(n, vq); 705 vhost_net_enable_vq(n, vq);
706
707 r = vhost_init_used(vq);
708 if (r)
709 goto err_vq;
706 } 710 }
707 711
708 mutex_unlock(&vq->mutex); 712 mutex_unlock(&vq->mutex);