do not forbid other processes to use the pwqr fd.
authorPierre Habouzit <pierre.habouzit@intersec.com>
Sun, 15 Jan 2012 08:03:38 +0000 (09:03 +0100)
committerPierre Habouzit <pierre.habouzit@intersec.com>
Sun, 15 Jan 2012 08:15:29 +0000 (09:15 +0100)
Actually it could even make sense, to have stuff running in the background
and wanting to be accounted in the overall load of this process group (for
example some kind of snapshot procedure that would be forke()d in the
background).

Plus this restriction was kind of un-kernelish.

Signed-off-by: Pierre Habouzit <pierre.habouzit@intersec.com>
kernel/pwqr.c

index 8592a00..a6ff8e5 100644 (file)
@@ -60,7 +60,6 @@ struct pwqr_sb {
        struct rcu_head         rcu;
        struct timer_list       timer;
        wait_queue_head_t       wqh;
-       pid_t                   tgid;
 
        unsigned                concurrency;
        unsigned                registered;
@@ -149,8 +148,7 @@ static struct pwqr_sb *pwqr_sb_create(void)
 
        kref_init(&sb->kref);
        init_waitqueue_head(&sb->wqh);
-       sb->tgid        = current->tgid;
-       sb->concurrency = num_online_cpus();
+       sb->concurrency    = num_online_cpus();
        init_timer(&sb->timer);
        sb->timer.function = pwqr_sb_timer_cb;
        sb->timer.data     = (unsigned long)sb;
@@ -374,7 +372,7 @@ static int pwqr_release(struct inode *inode, struct file *filp)
 
 static long
 do_pwqr_wait(struct pwqr_sb *sb, struct pwqr_task *pwqt,
-           int is_wait, struct pwqr_ioc_wait __user *arg)
+            int is_wait, struct pwqr_ioc_wait __user *arg)
 {
        unsigned long flags;
        struct pwqr_ioc_wait wait;
@@ -563,9 +561,6 @@ static long pwqr_ioctl(struct file *filp, unsigned command, unsigned long arg)
        struct pwqr_task   *pwqt;
        int rc = 0;
 
-       if (sb->tgid != current->tgid)
-               return -EBADFD;
-
        switch (command) {
        case PWQR_GET_CONC:
                return sb->concurrency;