rpms/rpm/devel rpm-4.4.2-rpmsq-deadlock.patch, NONE, 1.1 rpm.spec, 1.192, 1.193
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Tue Jan 31 16:20:34 UTC 2006
- Previous message (by thread): rpms/xorg-x11-resutils/devel .cvsignore, 1.3, 1.4 sources, 1.3, 1.4 xorg-x11-resutils.spec, 1.5, 1.6
- Next message (by thread): rpms/NetworkManager/devel .cvsignore, 1.26, 1.27 NetworkManager.spec, 1.82, 1.83 sources, 1.41, 1.42
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: pnasrat
Update of /cvs/dist/rpms/rpm/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv9816
Modified Files:
rpm.spec
Added Files:
rpm-4.4.2-rpmsq-deadlock.patch
Log Message:
Rebuild for neon
rpm-4.4.2-rpmsq-deadlock.patch:
rpmsq.c | 53 +++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 41 insertions(+), 12 deletions(-)
--- NEW FILE rpm-4.4.2-rpmsq-deadlock.patch ---
--- rpm-4.4.2/rpmio/rpmsq.c.deadlock 2005-07-13 06:47:03.000000000 -0400
+++ rpm-4.4.2/rpmio/rpmsq.c 2006-01-30 21:00:13.000000000 -0500
@@ -218,7 +218,6 @@
sq->id = ME();
ret = pthread_mutex_init(&sq->mutex, NULL);
- ret = pthread_cond_init(&sq->cond, NULL);
insque(elem, (prev != NULL ? prev : rpmsqQueue));
ret = sigrelse(SIGCHLD);
}
@@ -240,8 +239,11 @@
ret = sighold (SIGCHLD);
if (ret == 0) {
remque(elem);
- ret = pthread_cond_destroy(&sq->cond);
- ret = pthread_mutex_destroy(&sq->mutex);
+
+ /* Unlock the mutex and then destroy it */
+ if((ret = pthread_mutex_unlock(&sq->mutex)) == 0)
+ ret = pthread_mutex_destroy(&sq->mutex);
+
sq->id = NULL;
/*@-bounds@*/
if (sq->pipes[1]) ret = close(sq->pipes[1]);
@@ -315,11 +317,20 @@
sq != NULL && sq != rpmsqQueue;
sq = sq->q_forw)
{
+ int ret;
+
if (sq->child != reaped)
/*@innercontinue@*/ continue;
sq->reaped = reaped;
sq->status = status;
- (void) pthread_cond_signal(&sq->cond);
+
+ /* Unlock the mutex. The waiter will then be able to
+ * aquire the lock.
+ *
+ * XXX: jbj, wtd, if this fails?
+ */
+ ret = pthread_mutex_unlock(&sq->mutex);
+
/*@innerbreak@*/ break;
}
}
@@ -391,6 +402,7 @@
{
pid_t pid;
int xx;
+ int nothreads = 0; /* XXX: Shouldn't this be a global? */
if (sq->reaper) {
xx = rpmsqInsert(sq, NULL);
@@ -405,6 +417,24 @@
xx = sighold(SIGCHLD);
+ /*
+ * Initialize the cond var mutex. We have to aquire the lock we
+ * use for the condition before we fork. Otherwise it is possible for
+ * the child to exit, we get sigchild and the sig handler to send
+ * the condition signal before we are waiting on the condition.
+ */
+ if (!nothreads) {
+ if(pthread_mutex_lock(&sq->mutex)) {
+ /* Yack we did not get the lock, lets just give up */
+/*@-bounds@*/
+ xx = close(sq->pipes[0]);
+ xx = close(sq->pipes[1]);
+ sq->pipes[0] = sq->pipes[1] = -1;
+/*@=bounds@*/
+ goto out;
+ }
+ }
+
pid = fork();
if (pid < (pid_t) 0) { /* fork failed. */
/*@-bounds@*/
@@ -462,10 +492,6 @@
/* Protect sq->reaped from handler changes. */
ret = sighold(SIGCHLD);
- /* Initialize the cond var mutex. */
- if (!nothreads)
- ret = pthread_mutex_lock(&sq->mutex);
-
/* Start the child, linux often runs child before parent. */
/*@-bounds@*/
if (sq->pipes[0] >= 0)
@@ -486,7 +512,13 @@
ret = sigpause(SIGCHLD);
else {
xx = sigrelse(SIGCHLD);
- ret = pthread_cond_wait(&sq->cond, &sq->mutex);
+
+ /*
+ * We start before the fork with this mutex locked;
+ * The only one that unlocks this the signal handler.
+ * So if we get the lock the child has been reaped.
+ */
+ ret = pthread_mutex_lock(&sq->mutex);
xx = sighold(SIGCHLD);
}
}
@@ -495,9 +527,6 @@
/* Accumulate stopwatch time spent waiting, potential performance gain. */
sq->ms_scriptlets += rpmswExit(&sq->op, -1)/1000;
- /* Tear down cond var mutex, our child has been reaped. */
- if (!nothreads)
- xx = pthread_mutex_unlock(&sq->mutex);
xx = sigrelse(SIGCHLD);
#ifdef _RPMSQ_DEBUG
Index: rpm.spec
===================================================================
RCS file: /cvs/dist/rpms/rpm/devel/rpm.spec,v
retrieving revision 1.192
retrieving revision 1.193
diff -u -r1.192 -r1.193
--- rpm.spec 18 Jan 2006 16:35:14 -0000 1.192
+++ rpm.spec 31 Jan 2006 16:20:31 -0000 1.193
@@ -20,7 +20,7 @@
%define version 4.4.2
Version: %{version}
%{expand: %%define rpm_version %{version}}
-Release: 14
+Release: 15
Group: System Environment/Base
Source: ftp://wraptastic.org/pub/rpm-4.4.x/rpm-%{rpm_version}.tar.gz
Source1: mono-find-provides
@@ -44,6 +44,7 @@
Patch16: rpm-4.4.2-file-softmagic.patch
Patch17: rpm-4.4.2-no-large-mmap.patch
Patch18: rpm-4.4.2-perlmainprov.patch
+Patch19: rpm-4.4.2-rpmsq-deadlock.patch
License: GPL
Conflicts: patch < 2.5
%ifos linux
@@ -174,6 +175,7 @@
%patch16 -p1 -b .magic
%patch17 -p1 -b .no_large_mmap
%patch18 -p1 -b .perlmainprov
+%patch19 -p1 -b .deadlock
%build
@@ -566,6 +568,10 @@
%{__includedir}/popt.h
%changelog
+* Mon Jan 30 2006 Paul Nasrat <pnasrat at redhat.com> - 4.4.2-15
+- Rebuild for newer neon
+- Fix scriptlet deadlock (#146549)
+
* Wed Jan 18 2006 Paul Nasrat <pnasrat at redhat.com> - 4.4.2-14
- Don't emit perl(main) (#177960)
- Previous message (by thread): rpms/xorg-x11-resutils/devel .cvsignore, 1.3, 1.4 sources, 1.3, 1.4 xorg-x11-resutils.spec, 1.5, 1.6
- Next message (by thread): rpms/NetworkManager/devel .cvsignore, 1.26, 1.27 NetworkManager.spec, 1.82, 1.83 sources, 1.41, 1.42
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-cvs-commits
mailing list