[PATCH 10/10] Bsdacct: account task in each namespace is is visible from

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Oleg Nesterov <oleg@...>, Sukadev Bhattiprolu <sukadev@...>, Alexey Dobriyan <adobriyan@...>
Cc: Linux Containers <containers@...>, Linux Kernel Mailing List <linux-kernel@...>
Date: Thursday, April 10, 2008 - 4:59 am

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.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---
 kernel/acct.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/kernel/acct.c b/kernel/acct.c
index 7fc9f9d..0feba97 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -631,15 +631,9 @@ void acct_collect(long exitcode, int group_dead)
 	spin_unlock_irq(&current->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,16 @@ void acct_process(void)
 	do_acct_process(acct, ns, file);
 	fput(file);
 }
+
+/**
+ * acct_process - now just a wrapper around do_acct_process
+ *
+ * handles process accounting for an exiting task
+ */
+void acct_process(void)
+{
+	struct pid_namespace *ns;
+
+	for (ns = task_active_pid_ns(current); ns != NULL; ns = ns->parent)
+		acct_process_in_ns(ns);
+}
-- 
1.5.3.4

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 4/10] Bsdacct: fix bogus comment near acct_process, Pavel Emelyanov, (Thu Apr 10, 4:45 am)
[PATCH 6/10] Bsdacct: make the acct_lock global, Pavel Emelyanov, (Thu Apr 10, 4:49 am)
[PATCH 10/10] Bsdacct: account task in each namespace is is ..., Pavel Emelyanov, (Thu Apr 10, 4:59 am)
[PATCH 5/10] Bsdacct: make check timer accept an argument, Pavel Emelyanov, (Thu Apr 10, 4:47 am)
[PATCH 8/10] Bsdacct: make bsd_acct_struct per pid namespace, Pavel Emelyanov, (Thu Apr 10, 4:54 am)
[PATCH 1/10] Bsdacct: rename acct_glbl structure, Pavel Emelyanov, (Thu Apr 10, 4:41 am)