oom_ajd: don't use WARN_ONCE, just use printk_once
[pandora-kernel.git] / fs / proc / base.c
index c9e3f65..73a562b 100644 (file)
@@ -1118,7 +1118,7 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
         * Warn that /proc/pid/oom_adj is deprecated, see
         * Documentation/feature-removal-schedule.txt.
         */
-       WARN_ONCE(1, "%s (%d): /proc/%d/oom_adj is deprecated, please use /proc/%d/oom_score_adj instead.\n",
+       printk_once(KERN_WARNING "%s (%d): /proc/%d/oom_adj is deprecated, please use /proc/%d/oom_score_adj instead.\n",
                  current->comm, task_pid_nr(current), task_pid_nr(task),
                  task_pid_nr(task));
        task->signal->oom_adj = oom_adjust;
@@ -2706,9 +2706,16 @@ static int do_io_accounting(struct task_struct *task, char *buffer, int whole)
 {
        struct task_io_accounting acct = task->ioac;
        unsigned long flags;
+       int result;
 
-       if (!ptrace_may_access(task, PTRACE_MODE_READ))
-               return -EACCES;
+       result = mutex_lock_killable(&task->signal->cred_guard_mutex);
+       if (result)
+               return result;
+
+       if (!ptrace_may_access(task, PTRACE_MODE_READ)) {
+               result = -EACCES;
+               goto out_unlock;
+       }
 
        if (whole && lock_task_sighand(task, &flags)) {
                struct task_struct *t = task;
@@ -2719,7 +2726,7 @@ static int do_io_accounting(struct task_struct *task, char *buffer, int whole)
 
                unlock_task_sighand(task, &flags);
        }
-       return sprintf(buffer,
+       result = sprintf(buffer,
                        "rchar: %llu\n"
                        "wchar: %llu\n"
                        "syscr: %llu\n"
@@ -2734,6 +2741,9 @@ static int do_io_accounting(struct task_struct *task, char *buffer, int whole)
                        (unsigned long long)acct.read_bytes,
                        (unsigned long long)acct.write_bytes,
                        (unsigned long long)acct.cancelled_write_bytes);
+out_unlock:
+       mutex_unlock(&task->signal->cred_guard_mutex);
+       return result;
 }
 
 static int proc_tid_io_accounting(struct task_struct *task, char *buffer)