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>
This commit is contained in:
parent
b5a7174875
commit
7d1e13505b
|
@ -631,15 +631,9 @@ void acct_collect(long exitcode, int group_dead)
|
||||||
spin_unlock_irq(¤t->sighand->siglock);
|
spin_unlock_irq(¤t->sighand->siglock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static void acct_process_in_ns(struct pid_namespace *ns)
|
||||||
* acct_process - now just a wrapper around do_acct_process
|
|
||||||
*
|
|
||||||
* handles process accounting for an exiting task
|
|
||||||
*/
|
|
||||||
void acct_process(void)
|
|
||||||
{
|
{
|
||||||
struct file *file = NULL;
|
struct file *file = NULL;
|
||||||
struct pid_namespace *ns = task_active_pid_ns(current);
|
|
||||||
struct bsd_acct_struct *acct;
|
struct bsd_acct_struct *acct;
|
||||||
|
|
||||||
acct = ns->bacct;
|
acct = ns->bacct;
|
||||||
|
@ -661,3 +655,16 @@ void acct_process(void)
|
||||||
do_acct_process(acct, ns, file);
|
do_acct_process(acct, ns, file);
|
||||||
fput(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);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue