about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 15:40:54 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 15:40:54 +0000
commitd8cdfda31e549353cad281ac112fcde6db6e521b (patch)
tree314e977912cbcb293ebd80a0150302b572c89154
parenteff61d5bf192516c4b075983fe899ad4ababb312 (diff)
downloadglibc-d8cdfda31e549353cad281ac112fcde6db6e521b.tar.gz
glibc-d8cdfda31e549353cad281ac112fcde6db6e521b.tar.xz
glibc-d8cdfda31e549353cad281ac112fcde6db6e521b.zip
2007-02-25 Ulrich Drepper <drepper@redhat.com>
	* sysdeps/unix/sysv/linux/fork.c (__libc_fork): Reset refcntr in
	new thread, don't just decrement it.
	Patch by Suzuki K P <suzuki@in.ibm.com>.
-rw-r--r--nptl/ChangeLog6
-rw-r--r--nptl/sysdeps/unix/sysv/linux/fork.c7
2 files changed, 11 insertions, 2 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 6fa76ca4e5..a3ba15dc8d 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -186,6 +186,12 @@
 	* tst-cancel-wrappers.sh: Set C["fdatasync"] to 1.
 	* tst-cancel4.c (tf_fdatasync): New test.
 
+2007-02-25  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/fork.c (__libc_fork): Reset refcntr in
+	new thread, don't just decrement it.
+	Patch by Suzuki K P <suzuki@in.ibm.com>.
+
 2007-02-09  Jakub Jelinek  <jakub@redhat.com>
 
 	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
diff --git a/nptl/sysdeps/unix/sysv/linux/fork.c b/nptl/sysdeps/unix/sysv/linux/fork.c
index 840974401b..f6691e1344 100644
--- a/nptl/sysdeps/unix/sysv/linux/fork.c
+++ b/nptl/sysdeps/unix/sysv/linux/fork.c
@@ -167,8 +167,11 @@ __libc_fork (void)
 	    allp->handler->child_handler ();
 
 	  /* Note that we do not have to wake any possible waiter.
-	     This is the only thread in the new process.  */
-	  --allp->handler->refcntr;
+ 	     This is the only thread in the new process.  The count
+ 	     may have been bumped up by other threads doing a fork.
+ 	     We reset it to 1, to avoid waiting for non-existing
+ 	     thread(s) to release the count.  */
+	  allp->handler->refcntr = 1;
 
 	  /* XXX We could at this point look through the object pool
 	     and mark all objects not on the __fork_handlers list as