Merge branch 'core-hweight-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-block.git] / kernel / acct.c
index a6605ca921b6a6a9538ac645dadee177ef34f9b9..e4c0e1fee9b0022f8c0a15f7ed267e86f9d7d246 100644 (file)
@@ -353,17 +353,18 @@ restart:
 
 void acct_exit_ns(struct pid_namespace *ns)
 {
-       struct bsd_acct_struct *acct;
+       struct bsd_acct_struct *acct = ns->bacct;
 
-       spin_lock(&acct_lock);
-       acct = ns->bacct;
-       if (acct != NULL) {
-               if (acct->file != NULL)
-                       acct_file_reopen(acct, NULL, NULL);
+       if (acct == NULL)
+               return;
 
-               kfree(acct);
-       }
+       del_timer_sync(&acct->timer);
+       spin_lock(&acct_lock);
+       if (acct->file != NULL)
+               acct_file_reopen(acct, NULL, NULL);
        spin_unlock(&acct_lock);
+
+       kfree(acct);
 }
 
 /*
@@ -587,16 +588,6 @@ out:
        revert_creds(orig_cred);
 }
 
-/**
- * acct_init_pacct - initialize a new pacct_struct
- * @pacct: per-process accounting info struct to initialize
- */
-void acct_init_pacct(struct pacct_struct *pacct)
-{
-       memset(pacct, 0, sizeof(struct pacct_struct));
-       pacct->ac_utime = pacct->ac_stime = cputime_zero;
-}
-
 /**
  * acct_collect - collect accounting information into pacct_struct
  * @exitcode: task exit code