Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139193
b: refs/heads/master
c: abff55c
h: refs/heads/master
i:
  139191: 320c83f
v: v3
  • Loading branch information
Tony Battersby authored and Linus Torvalds committed Apr 1, 2009
1 parent 2ac917d commit 7d0a780
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 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: bb57c3edcd2fc51d95914c39448f36e43af9d6af
refs/heads/master: abff55cee1039b5a3b96f7a5eb6e65b9f247a274
15 changes: 8 additions & 7 deletions trunk/fs/eventpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ struct epoll_filefd {
*/
struct nested_call_node {
struct list_head llink;
struct task_struct *task;
void *cookie;
int cpu;
};

/*
Expand Down Expand Up @@ -327,7 +327,7 @@ static int ep_call_nested(struct nested_calls *ncalls, int max_nests,
{
int error, call_nests = 0;
unsigned long flags;
struct task_struct *this_task = current;
int this_cpu = get_cpu();
struct list_head *lsthead = &ncalls->tasks_call_list;
struct nested_call_node *tncur;
struct nested_call_node tnode;
Expand All @@ -340,20 +340,19 @@ static int ep_call_nested(struct nested_calls *ncalls, int max_nests,
* very much limited.
*/
list_for_each_entry(tncur, lsthead, llink) {
if (tncur->task == this_task &&
if (tncur->cpu == this_cpu &&
(tncur->cookie == cookie || ++call_nests > max_nests)) {
/*
* Ops ... loop detected or maximum nest level reached.
* We abort this wake by breaking the cycle itself.
*/
spin_unlock_irqrestore(&ncalls->lock, flags);

return -1;
error = -1;
goto out_unlock;
}
}

/* Add the current task and cookie to the list */
tnode.task = this_task;
tnode.cpu = this_cpu;
tnode.cookie = cookie;
list_add(&tnode.llink, lsthead);

Expand All @@ -365,8 +364,10 @@ static int ep_call_nested(struct nested_calls *ncalls, int max_nests,
/* Remove the current task from the list */
spin_lock_irqsave(&ncalls->lock, flags);
list_del(&tnode.llink);
out_unlock:
spin_unlock_irqrestore(&ncalls->lock, flags);

put_cpu();
return error;
}

Expand Down

0 comments on commit 7d0a780

Please sign in to comment.