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/vhost.c | |
parent | 8c6b0865aa80c4f30baa343d3d707389f738af48 (diff) | |
parent | ea5d404655ba3b356d0c06d6a3c4f24112124522 (diff) | |
download | linux-3.10-f1e84eb3bba3d6a5691ce1832ff7e550768560d8.tar.gz linux-3.10-f1e84eb3bba3d6a5691ce1832ff7e550768560d8.tar.bz2 linux-3.10-f1e84eb3bba3d6a5691ce1832ff7e550768560d8.zip |
Merge branch 'vhost-net' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
Diffstat (limited to 'drivers/vhost/vhost.c')
-rw-r--r-- | drivers/vhost/vhost.c | 11 |
1 files changed, 7 insertions, 4 deletions
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) if (work) { __set_current_state(TASK_RUNNING); work->fn(work); + if (need_resched()) + schedule(); } else schedule(); @@ -403,7 +405,7 @@ long vhost_dev_reset_owner(struct vhost_dev *dev) if (!memory) return -ENOMEM; - vhost_dev_cleanup(dev); + vhost_dev_cleanup(dev, true); memory->nregions = 0; RCU_INIT_POINTER(dev->memory, memory); @@ -434,8 +436,8 @@ int vhost_zerocopy_signal_used(struct vhost_virtqueue *vq) return j; } -/* Caller should have device mutex */ -void vhost_dev_cleanup(struct vhost_dev *dev) +/* Caller should have device mutex if and only if locked is set */ +void vhost_dev_cleanup(struct vhost_dev *dev, bool locked) { int i; @@ -472,7 +474,8 @@ void vhost_dev_cleanup(struct vhost_dev *dev) dev->log_file = NULL; /* No one will access memory at this point */ kfree(rcu_dereference_protected(dev->memory, - lockdep_is_held(&dev->mutex))); + locked == + lockdep_is_held(&dev->mutex))); RCU_INIT_POINTER(dev->memory, NULL); WARN_ON(!list_empty(&dev->work_list)); if (dev->worker) { |