Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 349624
b: refs/heads/master
c: 692a998
h: refs/heads/master
v: v3
  • Loading branch information
Jason Wang authored and David S. Miller committed Jan 29, 2013
1 parent 041d3b4 commit 53805de
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: af668b3c276d0f958a3aa46ef8ec47e2d5d333b3
refs/heads/master: 692a998b908ae4c612d95d1f5f5adae03eca2b79
16 changes: 11 additions & 5 deletions trunk/drivers/vhost/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -827,15 +827,16 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
r = PTR_ERR(ubufs);
goto err_ubufs;
}
oldubufs = vq->ubufs;
vq->ubufs = ubufs;

vhost_net_disable_vq(n, vq);
rcu_assign_pointer(vq->private_data, sock);
vhost_net_enable_vq(n, vq);

r = vhost_init_used(vq);
if (r)
goto err_vq;
goto err_used;
vhost_net_enable_vq(n, vq);

oldubufs = vq->ubufs;
vq->ubufs = ubufs;

n->tx_packets = 0;
n->tx_zcopy_err = 0;
Expand All @@ -859,6 +860,11 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
mutex_unlock(&n->dev.mutex);
return 0;

err_used:
rcu_assign_pointer(vq->private_data, oldsock);
vhost_net_enable_vq(n, vq);
if (ubufs)
vhost_ubuf_put_and_wait(ubufs);
err_ubufs:
fput(sock->file);
err_vq:
Expand Down

0 comments on commit 53805de

Please sign in to comment.