Commit 5e6b3f42 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

[PATCH] proc: convert task_sig() to use lock_task_sighand()

lock_task_sighand() can take ->siglock without holding tasklist_lock.
Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7fbaac00
...@@ -244,6 +244,7 @@ static void collect_sigign_sigcatch(struct task_struct *p, sigset_t *ign, ...@@ -244,6 +244,7 @@ static void collect_sigign_sigcatch(struct task_struct *p, sigset_t *ign,
static inline char * task_sig(struct task_struct *p, char *buffer) static inline char * task_sig(struct task_struct *p, char *buffer)
{ {
unsigned long flags;
sigset_t pending, shpending, blocked, ignored, caught; sigset_t pending, shpending, blocked, ignored, caught;
int num_threads = 0; int num_threads = 0;
unsigned long qsize = 0; unsigned long qsize = 0;
...@@ -255,10 +256,8 @@ static inline char * task_sig(struct task_struct *p, char *buffer) ...@@ -255,10 +256,8 @@ static inline char * task_sig(struct task_struct *p, char *buffer)
sigemptyset(&ignored); sigemptyset(&ignored);
sigemptyset(&caught); sigemptyset(&caught);
/* Gather all the data with the appropriate locks held */ rcu_read_lock();
read_lock(&tasklist_lock); if (lock_task_sighand(p, &flags)) {
if (p->sighand) {
spin_lock_irq(&p->sighand->siglock);
pending = p->pending.signal; pending = p->pending.signal;
shpending = p->signal->shared_pending.signal; shpending = p->signal->shared_pending.signal;
blocked = p->blocked; blocked = p->blocked;
...@@ -266,9 +265,9 @@ static inline char * task_sig(struct task_struct *p, char *buffer) ...@@ -266,9 +265,9 @@ static inline char * task_sig(struct task_struct *p, char *buffer)
num_threads = atomic_read(&p->signal->count); num_threads = atomic_read(&p->signal->count);
qsize = atomic_read(&p->user->sigpending); qsize = atomic_read(&p->user->sigpending);
qlim = p->signal->rlim[RLIMIT_SIGPENDING].rlim_cur; qlim = p->signal->rlim[RLIMIT_SIGPENDING].rlim_cur;
spin_unlock_irq(&p->sighand->siglock); unlock_task_sighand(p, &flags);
} }
read_unlock(&tasklist_lock); rcu_read_unlock();
buffer += sprintf(buffer, "Threads:\t%d\n", num_threads); buffer += sprintf(buffer, "Threads:\t%d\n", num_threads);
buffer += sprintf(buffer, "SigQ:\t%lu/%lu\n", qsize, qlim); buffer += sprintf(buffer, "SigQ:\t%lu/%lu\n", qsize, qlim);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment