aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2010-07-15 08:19:12 -0400
committerMichael S. Tsirkin <mst@redhat.com>2010-07-15 08:26:12 -0400
commit1680e9063ea28099a1efa8ca11cee069cc7a9bc3 (patch)
tree92fda29b75a081151d6e460f7ae8ec874517b6e5
parent7b3384fc30633738ae4eaf8e1bc6ce70470ced80 (diff)
vhost-net: avoid flush under lock
We flush under vq mutex when changing backends. This creates a deadlock as workqueue being flushed needs this lock as well. https://bugzilla.redhat.com/show_bug.cgi?id=612421 Drop the vq mutex before flush: we have the device mutex which is sufficient to prevent another ioctl from touching the vq. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--drivers/vhost/net.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 2406377a6e5e..2764e0fbf29b 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -534,11 +534,16 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
534 rcu_assign_pointer(vq->private_data, sock); 534 rcu_assign_pointer(vq->private_data, sock);
535 vhost_net_enable_vq(n, vq); 535 vhost_net_enable_vq(n, vq);
536done: 536done:
537 mutex_unlock(&vq->mutex);
538
537 if (oldsock) { 539 if (oldsock) {
538 vhost_net_flush_vq(n, index); 540 vhost_net_flush_vq(n, index);
539 fput(oldsock->file); 541 fput(oldsock->file);
540 } 542 }
541 543
544 mutex_unlock(&n->dev.mutex);
545 return 0;
546
542err_vq: 547err_vq:
543 mutex_unlock(&vq->mutex); 548 mutex_unlock(&vq->mutex);
544err: 549err: