Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d5df763b81946a405837b80874516dfc2a8f7ebf
Commit:     d5df763b81946a405837b80874516dfc2a8f7ebf
Parent:     56496c1d83dfae0c74e2f43adb45d2d95e16c0d5
Author:     Pavel Emelyanov <[EMAIL PROTECTED]>
AuthorDate: Fri Feb 8 04:19:22 2008 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Fri Feb 8 09:22:29 2008 -0800

    Clean up the kill_something_info
    
    This is the first step (of two) in removing the kill_pgrp_info.
    
    All the users of this function are in kernel/signal.c, but all they need is 
to
    call __kill_pgrp_info() with the tasklist_lock read-locked.
    
    Fortunately, one of its users is the kill_something_info(), which already
    needs this lock in one of its branches, so clean these branches up and call
    the __kill_pgrp_info() directly.
    
    Based on Oleg's view of how this function should look.
    
    Signed-off-by: Oleg Nesterov <[EMAIL PROTECTED]>
    Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 kernel/signal.c |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index cc45a6b..a805c74 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1134,14 +1134,22 @@ EXPORT_SYMBOL_GPL(kill_pid_info_as_uid);
 static int kill_something_info(int sig, struct siginfo *info, int pid)
 {
        int ret;
-       rcu_read_lock();
-       if (!pid) {
-               ret = kill_pgrp_info(sig, info, task_pgrp(current));
-       } else if (pid == -1) {
+
+       if (pid > 0) {
+               rcu_read_lock();
+               ret = kill_pid_info(sig, info, find_vpid(pid));
+               rcu_read_unlock();
+               return ret;
+       }
+
+       read_lock(&tasklist_lock);
+       if (pid != -1) {
+               ret = __kill_pgrp_info(sig, info,
+                               pid ? find_vpid(-pid) : task_pgrp(current));
+       } else {
                int retval = 0, count = 0;
                struct task_struct * p;
 
-               read_lock(&tasklist_lock);
                for_each_process(p) {
                        if (p->pid > 1 && !same_thread_group(p, current)) {
                                int err = group_send_sig_info(sig, info, p);
@@ -1150,14 +1158,10 @@ static int kill_something_info(int sig, struct siginfo 
*info, int pid)
                                        retval = err;
                        }
                }
-               read_unlock(&tasklist_lock);
                ret = count ? retval : -ESRCH;
-       } else if (pid < 0) {
-               ret = kill_pgrp_info(sig, info, find_vpid(-pid));
-       } else {
-               ret = kill_pid_info(sig, info, find_vpid(pid));
        }
-       rcu_read_unlock();
+       read_unlock(&tasklist_lock);
+
        return ret;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to