Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 179955
b: refs/heads/master
c: f1d1c30
h: refs/heads/master
i:
  179953: 0cecdaf
  179951: c6da429
v: v3
  • Loading branch information
Michael S. Tsirkin authored and Marcelo Tosatti committed Jan 25, 2010
1 parent 09ebb75 commit 9541896
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 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: 82b7005f0e72d8d1a8226e4c192cbb0850d10b3f
refs/heads/master: f1d1c309f35e9b0fb961cffd70fbd04f450ec47c
15 changes: 13 additions & 2 deletions trunk/virt/kvm/eventfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ irqfd_ptable_queue_proc(struct file *file, wait_queue_head_t *wqh,
static int
kvm_irqfd_assign(struct kvm *kvm, int fd, int gsi)
{
struct _irqfd *irqfd;
struct _irqfd *irqfd, *tmp;
struct file *file = NULL;
struct eventfd_ctx *eventfd = NULL;
int ret;
Expand Down Expand Up @@ -203,9 +203,20 @@ kvm_irqfd_assign(struct kvm *kvm, int fd, int gsi)
init_waitqueue_func_entry(&irqfd->wait, irqfd_wakeup);
init_poll_funcptr(&irqfd->pt, irqfd_ptable_queue_proc);

spin_lock_irq(&kvm->irqfds.lock);

ret = 0;
list_for_each_entry(tmp, &kvm->irqfds.items, list) {
if (irqfd->eventfd != tmp->eventfd)
continue;
/* This fd is used for another irq already. */
ret = -EBUSY;
spin_unlock_irq(&kvm->irqfds.lock);
goto fail;
}

events = file->f_op->poll(file, &irqfd->pt);

spin_lock_irq(&kvm->irqfds.lock);
list_add_tail(&irqfd->list, &kvm->irqfds.items);
spin_unlock_irq(&kvm->irqfds.lock);

Expand Down

0 comments on commit 9541896

Please sign in to comment.