|
@@ -103,22 +103,15 @@ SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio)
|
|
}
|
|
}
|
|
|
|
|
|
ret = -ESRCH;
|
|
ret = -ESRCH;
|
|
- /*
|
|
|
|
- * We want IOPRIO_WHO_PGRP/IOPRIO_WHO_USER to be "atomic",
|
|
|
|
- * so we can't use rcu_read_lock(). See re-copy of ->ioprio
|
|
|
|
- * in copy_process().
|
|
|
|
- */
|
|
|
|
- read_lock(&tasklist_lock);
|
|
|
|
|
|
+ rcu_read_lock();
|
|
switch (which) {
|
|
switch (which) {
|
|
case IOPRIO_WHO_PROCESS:
|
|
case IOPRIO_WHO_PROCESS:
|
|
- rcu_read_lock();
|
|
|
|
if (!who)
|
|
if (!who)
|
|
p = current;
|
|
p = current;
|
|
else
|
|
else
|
|
p = find_task_by_vpid(who);
|
|
p = find_task_by_vpid(who);
|
|
if (p)
|
|
if (p)
|
|
ret = set_task_ioprio(p, ioprio);
|
|
ret = set_task_ioprio(p, ioprio);
|
|
- rcu_read_unlock();
|
|
|
|
break;
|
|
break;
|
|
case IOPRIO_WHO_PGRP:
|
|
case IOPRIO_WHO_PGRP:
|
|
if (!who)
|
|
if (!who)
|
|
@@ -141,12 +134,7 @@ SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio)
|
|
break;
|
|
break;
|
|
|
|
|
|
do_each_thread(g, p) {
|
|
do_each_thread(g, p) {
|
|
- int match;
|
|
|
|
-
|
|
|
|
- rcu_read_lock();
|
|
|
|
- match = __task_cred(p)->uid == who;
|
|
|
|
- rcu_read_unlock();
|
|
|
|
- if (!match)
|
|
|
|
|
|
+ if (__task_cred(p)->uid != who)
|
|
continue;
|
|
continue;
|
|
ret = set_task_ioprio(p, ioprio);
|
|
ret = set_task_ioprio(p, ioprio);
|
|
if (ret)
|
|
if (ret)
|
|
@@ -160,7 +148,7 @@ free_uid:
|
|
ret = -EINVAL;
|
|
ret = -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
- read_unlock(&tasklist_lock);
|
|
|
|
|
|
+ rcu_read_unlock();
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -204,17 +192,15 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
|
|
int ret = -ESRCH;
|
|
int ret = -ESRCH;
|
|
int tmpio;
|
|
int tmpio;
|
|
|
|
|
|
- read_lock(&tasklist_lock);
|
|
|
|
|
|
+ rcu_read_lock();
|
|
switch (which) {
|
|
switch (which) {
|
|
case IOPRIO_WHO_PROCESS:
|
|
case IOPRIO_WHO_PROCESS:
|
|
- rcu_read_lock();
|
|
|
|
if (!who)
|
|
if (!who)
|
|
p = current;
|
|
p = current;
|
|
else
|
|
else
|
|
p = find_task_by_vpid(who);
|
|
p = find_task_by_vpid(who);
|
|
if (p)
|
|
if (p)
|
|
ret = get_task_ioprio(p);
|
|
ret = get_task_ioprio(p);
|
|
- rcu_read_unlock();
|
|
|
|
break;
|
|
break;
|
|
case IOPRIO_WHO_PGRP:
|
|
case IOPRIO_WHO_PGRP:
|
|
if (!who)
|
|
if (!who)
|
|
@@ -241,12 +227,7 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
|
|
break;
|
|
break;
|
|
|
|
|
|
do_each_thread(g, p) {
|
|
do_each_thread(g, p) {
|
|
- int match;
|
|
|
|
-
|
|
|
|
- rcu_read_lock();
|
|
|
|
- match = __task_cred(p)->uid == user->uid;
|
|
|
|
- rcu_read_unlock();
|
|
|
|
- if (!match)
|
|
|
|
|
|
+ if (__task_cred(p)->uid != user->uid)
|
|
continue;
|
|
continue;
|
|
tmpio = get_task_ioprio(p);
|
|
tmpio = get_task_ioprio(p);
|
|
if (tmpio < 0)
|
|
if (tmpio < 0)
|
|
@@ -264,6 +245,6 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
|
|
ret = -EINVAL;
|
|
ret = -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
- read_unlock(&tasklist_lock);
|
|
|
|
|
|
+ rcu_read_unlock();
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|