Commit cb41d6d0 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Linus Torvalds

Use find_task_by_vpid in taskstats

The pid to lookup a task by is passed inside taskstats code via genetlink
message.

Since netlink packets are now processed in the context of the sending task,
this is correct to lookup the task with find_task_by_vpid() here.

Besides, I fix the call to fill_pid() from taskstats_exit(), since the
tsk->pid is not required in fill_pid() in this case, and the pid field on
task_struct is going to be deprecated as well.
Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Jay Lan <jlan@engr.sgi.com>
Cc: Jonathan Lim <jlim@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b7127aa4
...@@ -183,7 +183,7 @@ static int fill_pid(pid_t pid, struct task_struct *tsk, ...@@ -183,7 +183,7 @@ static int fill_pid(pid_t pid, struct task_struct *tsk,
if (!tsk) { if (!tsk) {
rcu_read_lock(); rcu_read_lock();
tsk = find_task_by_pid(pid); tsk = find_task_by_vpid(pid);
if (tsk) if (tsk)
get_task_struct(tsk); get_task_struct(tsk);
rcu_read_unlock(); rcu_read_unlock();
...@@ -230,7 +230,7 @@ static int fill_tgid(pid_t tgid, struct task_struct *first, ...@@ -230,7 +230,7 @@ static int fill_tgid(pid_t tgid, struct task_struct *first,
*/ */
rcu_read_lock(); rcu_read_lock();
if (!first) if (!first)
first = find_task_by_pid(tgid); first = find_task_by_vpid(tgid);
if (!first || !lock_task_sighand(first, &flags)) if (!first || !lock_task_sighand(first, &flags))
goto out; goto out;
...@@ -547,7 +547,7 @@ void taskstats_exit(struct task_struct *tsk, int group_dead) ...@@ -547,7 +547,7 @@ void taskstats_exit(struct task_struct *tsk, int group_dead)
if (!stats) if (!stats)
goto err; goto err;
rc = fill_pid(tsk->pid, tsk, stats); rc = fill_pid(-1, tsk, stats);
if (rc < 0) if (rc < 0)
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment