diff options
Diffstat (limited to 'fs/ioprio.c')
-rw-r--r-- | fs/ioprio.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/fs/ioprio.c b/fs/ioprio.c index 78b1deae3fa2..6dc6721d9e82 100644 --- a/fs/ioprio.c +++ b/fs/ioprio.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * fs/ioprio.c | 2 | * fs/ioprio.c |
3 | * | 3 | * |
4 | * Copyright (C) 2004 Jens Axboe <axboe@suse.de> | 4 | * Copyright (C) 2004 Jens Axboe <axboe@kernel.dk> |
5 | * | 5 | * |
6 | * Helper functions for setting/querying io priorities of processes. The | 6 | * Helper functions for setting/querying io priorities of processes. The |
7 | * system calls closely mimmick getpriority/setpriority, see the man page for | 7 | * system calls closely mimmick getpriority/setpriority, see the man page for |
@@ -47,8 +47,8 @@ static int set_task_ioprio(struct task_struct *task, int ioprio) | |||
47 | /* see wmb() in current_io_context() */ | 47 | /* see wmb() in current_io_context() */ |
48 | smp_read_barrier_depends(); | 48 | smp_read_barrier_depends(); |
49 | 49 | ||
50 | if (ioc && ioc->set_ioprio) | 50 | if (ioc) |
51 | ioc->set_ioprio(ioc, ioprio); | 51 | ioc->ioprio_changed = 1; |
52 | 52 | ||
53 | task_unlock(task); | 53 | task_unlock(task); |
54 | return 0; | 54 | return 0; |
@@ -81,7 +81,12 @@ asmlinkage long sys_ioprio_set(int which, int who, int ioprio) | |||
81 | } | 81 | } |
82 | 82 | ||
83 | ret = -ESRCH; | 83 | ret = -ESRCH; |
84 | read_lock_irq(&tasklist_lock); | 84 | /* |
85 | * We want IOPRIO_WHO_PGRP/IOPRIO_WHO_USER to be "atomic", | ||
86 | * so we can't use rcu_read_lock(). See re-copy of ->ioprio | ||
87 | * in copy_process(). | ||
88 | */ | ||
89 | read_lock(&tasklist_lock); | ||
85 | switch (which) { | 90 | switch (which) { |
86 | case IOPRIO_WHO_PROCESS: | 91 | case IOPRIO_WHO_PROCESS: |
87 | if (!who) | 92 | if (!who) |
@@ -124,7 +129,7 @@ free_uid: | |||
124 | ret = -EINVAL; | 129 | ret = -EINVAL; |
125 | } | 130 | } |
126 | 131 | ||
127 | read_unlock_irq(&tasklist_lock); | 132 | read_unlock(&tasklist_lock); |
128 | return ret; | 133 | return ret; |
129 | } | 134 | } |
130 | 135 | ||
@@ -170,7 +175,7 @@ asmlinkage long sys_ioprio_get(int which, int who) | |||
170 | int ret = -ESRCH; | 175 | int ret = -ESRCH; |
171 | int tmpio; | 176 | int tmpio; |
172 | 177 | ||
173 | read_lock_irq(&tasklist_lock); | 178 | read_lock(&tasklist_lock); |
174 | switch (which) { | 179 | switch (which) { |
175 | case IOPRIO_WHO_PROCESS: | 180 | case IOPRIO_WHO_PROCESS: |
176 | if (!who) | 181 | if (!who) |
@@ -221,7 +226,7 @@ asmlinkage long sys_ioprio_get(int which, int who) | |||
221 | ret = -EINVAL; | 226 | ret = -EINVAL; |
222 | } | 227 | } |
223 | 228 | ||
224 | read_unlock_irq(&tasklist_lock); | 229 | read_unlock(&tasklist_lock); |
225 | return ret; | 230 | return ret; |
226 | } | 231 | } |
227 | 232 | ||