aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-07-25 04:48:48 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 13:53:47 -0400
commit7d1e13505be8c2bd2207894f4e0f069e1f9b51c9 (patch)
treed8471439c564bb15532c9dac041d0787faee2c90
parentb5a7174875ea570cc675f2c503e800db8efdd6a7 (diff)
bsdacct: account dying tasks in all relevant namespaces
This just makes the acct_proces walk the pid namespaces from current up to the top and account a task in each with the accounting turned on. ns->parent access if safe lockless, since current it still alive and holds its namespace, which in turn holds its parent. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Cc: Balbir Singh <balbir@in.ibm.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/acct.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/kernel/acct.c b/kernel/acct.c
index 7fc9f9dd1e9e..0feba97e114e 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -631,15 +631,9 @@ void acct_collect(long exitcode, int group_dead)
631 spin_unlock_irq(&current->sighand->siglock); 631 spin_unlock_irq(&current->sighand->siglock);
632} 632}
633 633
634/** 634static void acct_process_in_ns(struct pid_namespace *ns)
635 * acct_process - now just a wrapper around do_acct_process
636 *
637 * handles process accounting for an exiting task
638 */
639void acct_process(void)
640{ 635{
641 struct file *file = NULL; 636 struct file *file = NULL;
642 struct pid_namespace *ns = task_active_pid_ns(current);
643 struct bsd_acct_struct *acct; 637 struct bsd_acct_struct *acct;
644 638
645 acct = ns->bacct; 639 acct = ns->bacct;
@@ -661,3 +655,16 @@ void acct_process(void)
661 do_acct_process(acct, ns, file); 655 do_acct_process(acct, ns, file);
662 fput(file); 656 fput(file);
663} 657}
658
659/**
660 * acct_process - now just a wrapper around do_acct_process
661 *
662 * handles process accounting for an exiting task
663 */
664void acct_process(void)
665{
666 struct pid_namespace *ns;
667
668 for (ns = task_active_pid_ns(current); ns != NULL; ns = ns->parent)
669 acct_process_in_ns(ns);
670}