X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=kernel%2Facct.c;h=dd68b905941818df3253e6f60558a49b9fbf2ef4;hb=a4074d93dd4e8f46f727840baa2be02d544fd17f;hp=7fc9f9dd1e9e9ded263bc3261db4796cf500f54b;hpb=b5a7174875ea570cc675f2c503e800db8efdd6a7;p=linux-2.6 diff --git a/kernel/acct.c b/kernel/acct.c index 7fc9f9dd1e..dd68b90594 100644 --- a/kernel/acct.c +++ b/kernel/acct.c @@ -631,15 +631,9 @@ void acct_collect(long exitcode, int group_dead) spin_unlock_irq(¤t->sighand->siglock); } -/** - * acct_process - now just a wrapper around do_acct_process - * - * handles process accounting for an exiting task - */ -void acct_process(void) +static void acct_process_in_ns(struct pid_namespace *ns) { struct file *file = NULL; - struct pid_namespace *ns = task_active_pid_ns(current); struct bsd_acct_struct *acct; acct = ns->bacct; @@ -661,3 +655,22 @@ void acct_process(void) do_acct_process(acct, ns, file); fput(file); } + +/** + * 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 + */ +void acct_process(void) +{ + 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) + acct_process_in_ns(ns); +}