diff options
author | David S. Miller <davem@davemloft.net> | 2012-03-23 14:46:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-03-23 14:46:48 -0400 |
commit | f1e84eb3bba3d6a5691ce1832ff7e550768560d8 (patch) | |
tree | aadec1eb55b0281cba4701b85835b2bc4502a9cc /drivers/vhost | |
parent | 8c6b0865aa80c4f30baa343d3d707389f738af48 (diff) | |
parent | ea5d404655ba3b356d0c06d6a3c4f24112124522 (diff) |
Merge branch 'vhost-net' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
Diffstat (limited to 'drivers/vhost')
-rw-r--r-- | drivers/vhost/net.c | 2 | ||||
-rw-r--r-- | drivers/vhost/vhost.c | 11 | ||||
-rw-r--r-- | drivers/vhost/vhost.h | 2 |
3 files changed, 9 insertions, 6 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 9dab1f51dd4..f0da2c32fbd 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -588,7 +588,7 @@ static int vhost_net_release(struct inode *inode, struct file *f) | |||
588 | 588 | ||
589 | vhost_net_stop(n, &tx_sock, &rx_sock); | 589 | vhost_net_stop(n, &tx_sock, &rx_sock); |
590 | vhost_net_flush(n); | 590 | vhost_net_flush(n); |
591 | vhost_dev_cleanup(&n->dev); | 591 | vhost_dev_cleanup(&n->dev, false); |
592 | if (tx_sock) | 592 | if (tx_sock) |
593 | fput(tx_sock->file); | 593 | fput(tx_sock->file); |
594 | if (rx_sock) | 594 | if (rx_sock) |
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index bdb2d6436b2..947f00d8e09 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -222,6 +222,8 @@ static int vhost_worker(void *data) | |||
222 | if (work) { | 222 | if (work) { |
223 | __set_current_state(TASK_RUNNING); | 223 | __set_current_state(TASK_RUNNING); |
224 | work->fn(work); | 224 | work->fn(work); |
225 | if (need_resched()) | ||
226 | schedule(); | ||
225 | } else | 227 | } else |
226 | schedule(); | 228 | schedule(); |
227 | 229 | ||
@@ -403,7 +405,7 @@ long vhost_dev_reset_owner(struct vhost_dev *dev) | |||
403 | if (!memory) | 405 | if (!memory) |
404 | return -ENOMEM; | 406 | return -ENOMEM; |
405 | 407 | ||
406 | vhost_dev_cleanup(dev); | 408 | vhost_dev_cleanup(dev, true); |
407 | 409 | ||
408 | memory->nregions = 0; | 410 | memory->nregions = 0; |
409 | RCU_INIT_POINTER(dev->memory, memory); | 411 | RCU_INIT_POINTER(dev->memory, memory); |
@@ -434,8 +436,8 @@ int vhost_zerocopy_signal_used(struct vhost_virtqueue *vq) | |||
434 | return j; | 436 | return j; |
435 | } | 437 | } |
436 | 438 | ||
437 | /* Caller should have device mutex */ | 439 | /* Caller should have device mutex if and only if locked is set */ |
438 | void vhost_dev_cleanup(struct vhost_dev *dev) | 440 | void vhost_dev_cleanup(struct vhost_dev *dev, bool locked) |
439 | { | 441 | { |
440 | int i; | 442 | int i; |
441 | 443 | ||
@@ -472,7 +474,8 @@ void vhost_dev_cleanup(struct vhost_dev *dev) | |||
472 | dev->log_file = NULL; | 474 | dev->log_file = NULL; |
473 | /* No one will access memory at this point */ | 475 | /* No one will access memory at this point */ |
474 | kfree(rcu_dereference_protected(dev->memory, | 476 | kfree(rcu_dereference_protected(dev->memory, |
475 | lockdep_is_held(&dev->mutex))); | 477 | locked == |
478 | lockdep_is_held(&dev->mutex))); | ||
476 | RCU_INIT_POINTER(dev->memory, NULL); | 479 | RCU_INIT_POINTER(dev->memory, NULL); |
477 | WARN_ON(!list_empty(&dev->work_list)); | 480 | WARN_ON(!list_empty(&dev->work_list)); |
478 | if (dev->worker) { | 481 | if (dev->worker) { |
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index a801e2821d0..8dcf4cca6bf 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h | |||
@@ -163,7 +163,7 @@ struct vhost_dev { | |||
163 | long vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue *vqs, int nvqs); | 163 | long vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue *vqs, int nvqs); |
164 | long vhost_dev_check_owner(struct vhost_dev *); | 164 | long vhost_dev_check_owner(struct vhost_dev *); |
165 | long vhost_dev_reset_owner(struct vhost_dev *); | 165 | long vhost_dev_reset_owner(struct vhost_dev *); |
166 | void vhost_dev_cleanup(struct vhost_dev *); | 166 | void vhost_dev_cleanup(struct vhost_dev *, bool locked); |
167 | long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, unsigned long arg); | 167 | long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, unsigned long arg); |
168 | int vhost_vq_access_ok(struct vhost_virtqueue *vq); | 168 | int vhost_vq_access_ok(struct vhost_virtqueue *vq); |
169 | int vhost_log_access_ok(struct vhost_dev *); | 169 | int vhost_log_access_ok(struct vhost_dev *); |