diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2006-10-02 05:18:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 10:57:24 -0400 |
commit | 5e6b3f42edc20e988b186fbfb9eec174294222ea (patch) | |
tree | 3a99b922dab485df36e3a839b315b1ef2af5b0e9 /fs | |
parent | 7fbaac005cab2f3b4d6999cdb32fb93d442c5cdb (diff) |
[PATCH] proc: convert task_sig() to use lock_task_sighand()
lock_task_sighand() can take ->siglock without holding tasklist_lock.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/proc/array.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index c0e554971df0..279fbf542c88 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -244,6 +244,7 @@ static void collect_sigign_sigcatch(struct task_struct *p, sigset_t *ign, | |||
244 | 244 | ||
245 | static inline char * task_sig(struct task_struct *p, char *buffer) | 245 | static inline char * task_sig(struct task_struct *p, char *buffer) |
246 | { | 246 | { |
247 | unsigned long flags; | ||
247 | sigset_t pending, shpending, blocked, ignored, caught; | 248 | sigset_t pending, shpending, blocked, ignored, caught; |
248 | int num_threads = 0; | 249 | int num_threads = 0; |
249 | unsigned long qsize = 0; | 250 | unsigned long qsize = 0; |
@@ -255,10 +256,8 @@ static inline char * task_sig(struct task_struct *p, char *buffer) | |||
255 | sigemptyset(&ignored); | 256 | sigemptyset(&ignored); |
256 | sigemptyset(&caught); | 257 | sigemptyset(&caught); |
257 | 258 | ||
258 | /* Gather all the data with the appropriate locks held */ | 259 | rcu_read_lock(); |
259 | read_lock(&tasklist_lock); | 260 | if (lock_task_sighand(p, &flags)) { |
260 | if (p->sighand) { | ||
261 | spin_lock_irq(&p->sighand->siglock); | ||
262 | pending = p->pending.signal; | 261 | pending = p->pending.signal; |
263 | shpending = p->signal->shared_pending.signal; | 262 | shpending = p->signal->shared_pending.signal; |
264 | blocked = p->blocked; | 263 | blocked = p->blocked; |
@@ -266,9 +265,9 @@ static inline char * task_sig(struct task_struct *p, char *buffer) | |||
266 | num_threads = atomic_read(&p->signal->count); | 265 | num_threads = atomic_read(&p->signal->count); |
267 | qsize = atomic_read(&p->user->sigpending); | 266 | qsize = atomic_read(&p->user->sigpending); |
268 | qlim = p->signal->rlim[RLIMIT_SIGPENDING].rlim_cur; | 267 | qlim = p->signal->rlim[RLIMIT_SIGPENDING].rlim_cur; |
269 | spin_unlock_irq(&p->sighand->siglock); | 268 | unlock_task_sighand(p, &flags); |
270 | } | 269 | } |
271 | read_unlock(&tasklist_lock); | 270 | rcu_read_unlock(); |
272 | 271 | ||
273 | buffer += sprintf(buffer, "Threads:\t%d\n", num_threads); | 272 | buffer += sprintf(buffer, "Threads:\t%d\n", num_threads); |
274 | buffer += sprintf(buffer, "SigQ:\t%lu/%lu\n", qsize, qlim); | 273 | buffer += sprintf(buffer, "SigQ:\t%lu/%lu\n", qsize, qlim); |