提交 0c18d7a5 编写于 作者: P Pavel Emelyanov 提交者: Linus Torvalds

bsdacct: fix and add comments around acct_process()

Fix the one describing what this function is and add one more - about
locking absence around pid namespaces loop.
Signed-off-by: NPavel Emelyanov <xemul@openvz.org>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 7d1e1350
...@@ -657,7 +657,8 @@ static void acct_process_in_ns(struct pid_namespace *ns) ...@@ -657,7 +657,8 @@ static void acct_process_in_ns(struct pid_namespace *ns)
} }
/** /**
* acct_process - now just a wrapper around do_acct_process * acct_process - now just a wrapper around acct_process_in_ns,
* which in turn is a wrapper around do_acct_process.
* *
* handles process accounting for an exiting task * handles process accounting for an exiting task
*/ */
...@@ -665,6 +666,11 @@ void acct_process(void) ...@@ -665,6 +666,11 @@ void acct_process(void)
{ {
struct pid_namespace *ns; struct pid_namespace *ns;
/*
* This loop is safe lockless, since current is still
* alive and holds its namespace, which in turn holds
* its parent.
*/
for (ns = task_active_pid_ns(current); ns != NULL; ns = ns->parent) for (ns = task_active_pid_ns(current); ns != NULL; ns = ns->parent)
acct_process_in_ns(ns); acct_process_in_ns(ns);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册