Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 377013
b: refs/heads/master
c: 05c0535
h: refs/heads/master
i:
  377011: 21da4da
v: v3
  • Loading branch information
Michael S. Tsirkin authored and David S. Miller committed Jun 11, 2013
1 parent 0c34854 commit b8e3537
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 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: c2020be3c35ab230b4ee046c262ddab3e0d3aab4
refs/heads/master: 05c05351943cc03bf5c77e86953b24ae6fb21368
4 changes: 4 additions & 0 deletions trunk/drivers/vhost/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,10 @@ static long vhost_net_set_owner(struct vhost_net *n)
int r;

mutex_lock(&n->dev.mutex);
if (vhost_dev_has_owner(&n->dev)) {
r = -EBUSY;
goto out;
}
r = vhost_net_set_ubuf_info(n);
if (r)
goto out;
Expand Down
8 changes: 7 additions & 1 deletion trunk/drivers/vhost/vhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,14 +343,20 @@ static int vhost_attach_cgroups(struct vhost_dev *dev)
return attach.ret;
}

/* Caller should have device mutex */
bool vhost_dev_has_owner(struct vhost_dev *dev)
{
return dev->mm;
}

/* Caller should have device mutex */
long vhost_dev_set_owner(struct vhost_dev *dev)
{
struct task_struct *worker;
int err;

/* Is there an owner already? */
if (dev->mm) {
if (vhost_dev_has_owner(dev)) {
err = -EBUSY;
goto err_mm;
}
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/vhost/vhost.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ struct vhost_dev {

long vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, int nvqs);
long vhost_dev_set_owner(struct vhost_dev *dev);
bool vhost_dev_has_owner(struct vhost_dev *dev);
long vhost_dev_check_owner(struct vhost_dev *);
struct vhost_memory *vhost_dev_reset_owner_prepare(void);
void vhost_dev_reset_owner(struct vhost_dev *, struct vhost_memory *);
Expand Down

0 comments on commit b8e3537

Please sign in to comment.