Hello community, here is the log from the commit of package sysvinit for openSUSE:Factory checked in at 2012-06-25 14:41:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/sysvinit (Old) and /work/SRC/openSUSE:Factory/.sysvinit.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "sysvinit", Maintainer is "[email protected]" Changes: -------- --- /work/SRC/openSUSE:Factory/sysvinit/sysvinit.changes 2012-05-25 16:19:59.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.sysvinit.new/sysvinit.changes 2012-06-25 14:56:14.000000000 +0200 @@ -1,0 +2,5 @@ +Thu Jun 21 07:16:05 UTC 2012 - [email protected] + +- fix deadlock in blogd that happens on shutdown (bnc#730193) + +------------------------------------------------------------------- New: ---- showconsole-1.16-deadlock.diff ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sysvinit.spec ++++++ --- /var/tmp/diff_new_pack.dYt8sl/_old 2012-06-25 14:56:16.000000000 +0200 +++ /var/tmp/diff_new_pack.dYt8sl/_new 2012-06-25 14:56:16.000000000 +0200 @@ -16,6 +16,7 @@ # + Name: sysvinit %define PDVER 2.0.2 %define KPVER 2.21 @@ -59,6 +60,7 @@ Patch21: powerd-%{PDVER}-getaddrinfo.patch Patch30: killproc-%{KPVER}.dif Patch40: showconsole-%{SCVER}.dif +Patch41: showconsole-1.16-deadlock.diff Patch50: startpar-%{START}.dif Requires: mingetty Requires: sysvinit-tools @@ -126,6 +128,7 @@ popd pushd ../showconsole-%{SCVER} %patch40 +%patch41 -p1 ln -t../%{name}-%{SIVER}dsf/doc/showconsole README popd pushd ../startpar-%{START} ++++++ showconsole-1.16-deadlock.diff ++++++ >From 05c3f60fe02370f4c8d15b996bcc8d6f3dc57e12 Mon Sep 17 00:00:00 2001 From: Ludwig Nussel <[email protected]> Date: Thu, 21 Jun 2012 09:09:19 +0200 Subject: [PATCH] fix deadlock writelog() must not call pthread_yield() with the lock held that the main thread tries to get to cancel the writer thread. writelog() on the other hand needs to empty the buffer always to make sure poll() blocks again an doesn't cause a loop. --- libconsole.c | 25 +++++++++++++++++-------- 1 files changed, 17 insertions(+), 8 deletions(-) diff --git a/libconsole.c b/libconsole.c index b962032..54b353a 100644 --- a/libconsole.c +++ b/libconsole.c @@ -429,21 +429,28 @@ xout: static inline void writelog(void) { - if (!flog) + lock(&llock); + if (!flog) { /* log file closed, reset buffer */ + resetlog(); + unlock(&llock); return; + } clearerr(flog); - lock(&llock); while (avail > 0) { size_t ret = (size_t)avail; if (avail > TRANS_BUFFER_SIZE) ret = TRANS_BUFFER_SIZE; - if (!flog || nsigsys) + if (!flog || nsigsys) { /* log file closed, reset buffer */ + resetlog(); break; + } ret = fwrite(head, sizeof(unsigned char), ret, flog); - if (!ret && ferror(flog)) + if (!ret && ferror(flog)) { /* cannot write anymore, reset buffer */ + resetlog(); break; + } head += ret; if (head >= tail) { /* empty, reset buffer */ @@ -498,8 +505,13 @@ static inline int poll(int msec, mutex_t *outer) if (err == ETIMEDOUT || err == EBUSY) ret = 0; } - } else +#if 0 + } else { + unlock(&ljoin); pthread_yield(); + lock(&ljoin); +#endif + } return ret; } @@ -772,9 +784,6 @@ static void *action(void *dummy attribute((unused))) if (!poll(30, &ljoin)) continue; - if (!flog) - break; - writelog(); } unlock(&ljoin); -- 1.7.7 -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
