signal: Exit RCU read-side critical section on each pass through loop
[linux-2.6-block.git] / kernel / signal.c
index 8f0876f9f6dd5deb400a1f3ef071b66da877a363..54820984a872d1c1fa406ef06a40f05a1a98c2c0 100644 (file)
@@ -1331,23 +1331,21 @@ int kill_pid_info(int sig, struct siginfo *info, struct pid *pid)
        int error = -ESRCH;
        struct task_struct *p;
 
-       rcu_read_lock();
-retry:
-       p = pid_task(pid, PIDTYPE_PID);
-       if (p) {
-               error = group_send_sig_info(sig, info, p);
-               if (unlikely(error == -ESRCH))
-                       /*
-                        * The task was unhashed in between, try again.
-                        * If it is dead, pid_task() will return NULL,
-                        * if we race with de_thread() it will find the
-                        * new leader.
-                        */
-                       goto retry;
-       }
-       rcu_read_unlock();
+       for (;;) {
+               rcu_read_lock();
+               p = pid_task(pid, PIDTYPE_PID);
+               if (p)
+                       error = group_send_sig_info(sig, info, p);
+               rcu_read_unlock();
+               if (likely(!p || error != -ESRCH))
+                       return error;
 
-       return error;
+               /*
+                * The task was unhashed in between, try again.  If it
+                * is dead, pid_task() will return NULL, if we race with
+                * de_thread() it will find the new leader.
+                */
+       }
 }
 
 int kill_proc_info(int sig, struct siginfo *info, pid_t pid)