]> Git Repo - linux.git/commit
pids: refactor vnr/nr_ns helpers to make them safe
authorOleg Nesterov <[email protected]>
Thu, 2 Apr 2009 23:58:38 +0000 (16:58 -0700)
committerLinus Torvalds <[email protected]>
Fri, 3 Apr 2009 02:05:02 +0000 (19:05 -0700)
commit52ee2dfdd4f51cf422ea6a96a0846dc94244aa37
treee15753e01d2c2fbe980edc45f78a9ae77d2cf891
parent2ae448efc87df6d328f5835969076c7f9fce59c3
pids: refactor vnr/nr_ns helpers to make them safe

Inho, the safety rules for vnr/nr_ns helpers are horrible and buggy.

task_pid_nr_ns(task) needs rcu/tasklist depending on task == current.

As for "special" pids, vnr/nr_ns helpers always need rcu.  However, if
task != current, they are unsafe even under rcu lock, we can't trust
task->group_leader without the special checks.

And almost every helper has a callsite which needs a fix.

Also, it is a bit annoying that the implementations of, say,
task_pgrp_vnr() and task_pgrp_nr_ns() are not "symmetrical".

This patch introduces the new helper, __task_pid_nr_ns(), which is always
safe to use, and turns all other helpers into the trivial wrappers.

After this I'll send another patch which converts task_tgid_xxx() as well,
they're are a bit special.

Signed-off-by: Oleg Nesterov <[email protected]>
Cc: Louis Rilling <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Cc: Pavel Emelyanov <[email protected]>
Cc: Sukadev Bhattiprolu <[email protected]>
Cc: Roland McGrath <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
include/linux/sched.h
kernel/pid.c
This page took 0.048897 seconds and 4 git commands to generate.