snapshot: Use pm_mutex for mutual exclusion
[sfrench/cifs-2.6.git] / kernel / taskstats.c
index 9f360f68aad6b45df2125c558e4d9dc763ae6b9a..4a23517169a6495cf1aa1bc689137e1c38698c62 100644 (file)
@@ -183,7 +183,7 @@ static int fill_pid(pid_t pid, struct task_struct *tsk,
 
        if (!tsk) {
                rcu_read_lock();
-               tsk = find_task_by_pid(pid);
+               tsk = find_task_by_vpid(pid);
                if (tsk)
                        get_task_struct(tsk);
                rcu_read_unlock();
@@ -230,7 +230,7 @@ static int fill_tgid(pid_t tgid, struct task_struct *first,
         */
        rcu_read_lock();
        if (!first)
-               first = find_task_by_pid(tgid);
+               first = find_task_by_vpid(tgid);
 
        if (!first || !lock_task_sighand(first, &flags))
                goto out;
@@ -263,7 +263,7 @@ out:
 
        stats->version = TASKSTATS_VERSION;
        /*
-        * Accounting subsytems can also add calls here to modify
+        * Accounting subsystems can also add calls here to modify
         * fields of taskstats.
         */
        return rc;
@@ -398,31 +398,31 @@ static int cgroupstats_user_cmd(struct sk_buff *skb, struct genl_info *info)
 
        fd = nla_get_u32(info->attrs[CGROUPSTATS_CMD_ATTR_FD]);
        file = fget_light(fd, &fput_needed);
-       if (file) {
-               size = nla_total_size(sizeof(struct cgroupstats));
+       if (!file)
+               return 0;
 
-               rc = prepare_reply(info, CGROUPSTATS_CMD_NEW, &rep_skb,
-                                       size);
-               if (rc < 0)
-                       goto err;
+       size = nla_total_size(sizeof(struct cgroupstats));
 
-               na = nla_reserve(rep_skb, CGROUPSTATS_TYPE_CGROUP_STATS,
-                                       sizeof(struct cgroupstats));
-               stats = nla_data(na);
-               memset(stats, 0, sizeof(*stats));
+       rc = prepare_reply(info, CGROUPSTATS_CMD_NEW, &rep_skb,
+                               size);
+       if (rc < 0)
+               goto err;
 
-               rc = cgroupstats_build(stats, file->f_dentry);
-               if (rc < 0)
-                       goto err;
+       na = nla_reserve(rep_skb, CGROUPSTATS_TYPE_CGROUP_STATS,
+                               sizeof(struct cgroupstats));
+       stats = nla_data(na);
+       memset(stats, 0, sizeof(*stats));
 
-               fput_light(file, fput_needed);
-               return send_reply(rep_skb, info->snd_pid);
+       rc = cgroupstats_build(stats, file->f_dentry);
+       if (rc < 0) {
+               nlmsg_free(rep_skb);
+               goto err;
        }
 
+       rc = send_reply(rep_skb, info->snd_pid);
+
 err:
-       if (file)
-               fput_light(file, fput_needed);
-       nlmsg_free(rep_skb);
+       fput_light(file, fput_needed);
        return rc;
 }
 
@@ -547,7 +547,7 @@ void taskstats_exit(struct task_struct *tsk, int group_dead)
        if (!stats)
                goto err;
 
-       rc = fill_pid(tsk->pid, tsk, stats);
+       rc = fill_pid(-1, tsk, stats);
        if (rc < 0)
                goto err;