diff options
Diffstat (limited to 'kernel/acct.c')
-rw-r--r-- | kernel/acct.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/kernel/acct.c b/kernel/acct.c index 9a4715a2f6bf..e4c0e1fee9b0 100644 --- a/kernel/acct.c +++ b/kernel/acct.c | |||
@@ -353,17 +353,18 @@ restart: | |||
353 | 353 | ||
354 | void acct_exit_ns(struct pid_namespace *ns) | 354 | void acct_exit_ns(struct pid_namespace *ns) |
355 | { | 355 | { |
356 | struct bsd_acct_struct *acct; | 356 | struct bsd_acct_struct *acct = ns->bacct; |
357 | 357 | ||
358 | spin_lock(&acct_lock); | 358 | if (acct == NULL) |
359 | acct = ns->bacct; | 359 | return; |
360 | if (acct != NULL) { | ||
361 | if (acct->file != NULL) | ||
362 | acct_file_reopen(acct, NULL, NULL); | ||
363 | 360 | ||
364 | kfree(acct); | 361 | del_timer_sync(&acct->timer); |
365 | } | 362 | spin_lock(&acct_lock); |
363 | if (acct->file != NULL) | ||
364 | acct_file_reopen(acct, NULL, NULL); | ||
366 | spin_unlock(&acct_lock); | 365 | spin_unlock(&acct_lock); |
366 | |||
367 | kfree(acct); | ||
367 | } | 368 | } |
368 | 369 | ||
369 | /* | 370 | /* |
@@ -536,7 +537,8 @@ static void do_acct_process(struct bsd_acct_struct *acct, | |||
536 | do_div(elapsed, AHZ); | 537 | do_div(elapsed, AHZ); |
537 | ac.ac_btime = get_seconds() - elapsed; | 538 | ac.ac_btime = get_seconds() - elapsed; |
538 | /* we really need to bite the bullet and change layout */ | 539 | /* we really need to bite the bullet and change layout */ |
539 | current_uid_gid(&ac.ac_uid, &ac.ac_gid); | 540 | ac.ac_uid = orig_cred->uid; |
541 | ac.ac_gid = orig_cred->gid; | ||
540 | #if ACCT_VERSION==2 | 542 | #if ACCT_VERSION==2 |
541 | ac.ac_ahz = AHZ; | 543 | ac.ac_ahz = AHZ; |
542 | #endif | 544 | #endif |
@@ -587,16 +589,6 @@ out: | |||
587 | } | 589 | } |
588 | 590 | ||
589 | /** | 591 | /** |
590 | * acct_init_pacct - initialize a new pacct_struct | ||
591 | * @pacct: per-process accounting info struct to initialize | ||
592 | */ | ||
593 | void acct_init_pacct(struct pacct_struct *pacct) | ||
594 | { | ||
595 | memset(pacct, 0, sizeof(struct pacct_struct)); | ||
596 | pacct->ac_utime = pacct->ac_stime = cputime_zero; | ||
597 | } | ||
598 | |||
599 | /** | ||
600 | * acct_collect - collect accounting information into pacct_struct | 592 | * acct_collect - collect accounting information into pacct_struct |
601 | * @exitcode: task exit code | 593 | * @exitcode: task exit code |
602 | * @group_dead: not 0, if this thread is the last one in the process. | 594 | * @group_dead: not 0, if this thread is the last one in the process. |