public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave McCracken <dmccr@us.ibm.com>
To: Jeff Long <jeffwlong@hotmail.com>,
	linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@transmeta.com>
Subject: [PATCH] Re: Zombies with 2.4.15pre5 (exit.c)
Date: Tue, 20 Nov 2001 10:08:12 -0600	[thread overview]
Message-ID: <41490000.1006272492@baldur> (raw)
In-Reply-To: <F207EKzlO329qhXbGE400017908@hotmail.com>
In-Reply-To: <F207EKzlO329qhXbGE400017908@hotmail.com>


--On Saturday, November 17, 2001 03:45:49 +0000 Jeff Long
<jeffwlong@hotmail.com> wrote:

> Running 2.4.15pre5 (UP) on i386, running UML 2.4.14-2.
> UML processes create threads on the host system that don't
> die.  Threads are stuck at do_exit( ), so I backed out the
> patch to kernel/exit.c @ 539 (in 2.4.15pre5 patch):
> 
>   p->state = TASK_DEAD;
> 
> and things work fine.  I do not see zombies with anything
> other than UML processes/native threads.

The intent of the original patch was to make the task unfindable to other
waiters, which fixed a race condition in sys_wait4().  My assumption was
that the task was about to be cleaned up in release_task().  What I missed
was that there are a couple of code paths that don't release the task, but
assume it'll be cleaned up later.

The patch below should fix the problem.

Dave McCracken

======================================================================
Dave McCracken          IBM Linux Base Kernel Team      1-512-838-3059
dmccr@us.ibm.com                                        T/L   678-3059

-----------------------

--- linux-2.4.15-pre7/kernel/exit.c	Tue Nov 20 10:00:26 2001
+++ linux-2.4.15-pre7-patch/kernel/exit.c	Tue Nov 20 09:57:48 2001
@@ -544,8 +544,11 @@
 				retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0;
 				if (!retval && stat_addr)
 					retval = put_user(p->exit_code, stat_addr);
-				if (retval)
+				if (retval) {
+					/* Reset state. We're not cleaning up yet */
+					p->state = TASK_ZOMBIE;
 					goto end_wait4; 
+				}
 				retval = p->pid;
 				if (p->p_opptr != p->p_pptr) {
 					write_lock_irq(&tasklist_lock);
@@ -553,6 +556,8 @@
 					p->p_pptr = p->p_opptr;
 					SET_LINKS(p);
 					do_notify_parent(p, SIGCHLD);
+					/* Reset state. We're not cleaning up yet */
+					p->state = TASK_ZOMBIE;
 					write_unlock_irq(&tasklist_lock);
 				} else
 					release_task(p);


  reply	other threads:[~2001-11-20 16:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-17  3:45 Zombies with 2.4.15pre5 (exit.c) Jeff Long
2001-11-20 16:08 ` Dave McCracken [this message]
2001-11-20 18:40   ` [PATCH] " OGAWA Hirofumi
2001-11-21 18:10   ` Pau Aliagas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41490000.1006272492@baldur \
    --to=dmccr@us.ibm.com \
    --cc=jeffwlong@hotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox