From ce7b23d9d083a716ca2015caf3be103eef42304e Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 29 Jul 2015 11:32:06 +0100 Subject: [PATCH] Fix 'Cannot write data: Broken pipe [code=38 domain=7]' (RHBZ#1247746). --- 0001-rpc-Add-virNetDaemonHasClients.patch | 63 +++++++++++++++++++ ...c-Rework-timerActive-logic-in-daemon.patch | 59 +++++++++++++++++ libvirt.spec | 11 +++- 3 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 0001-rpc-Add-virNetDaemonHasClients.patch create mode 100644 0001-rpc-Rework-timerActive-logic-in-daemon.patch diff --git a/0001-rpc-Add-virNetDaemonHasClients.patch b/0001-rpc-Add-virNetDaemonHasClients.patch new file mode 100644 index 0000000..128adb2 --- /dev/null +++ b/0001-rpc-Add-virNetDaemonHasClients.patch @@ -0,0 +1,63 @@ +From 699faeacb10459fed748d425eb044ef69697e804 Mon Sep 17 00:00:00 2001 +From: Martin Kletzander +Date: Fri, 10 Jul 2015 10:34:52 +0200 +Subject: [PATCH] rpc: Add virNetDaemonHasClients + +So callers don't have to iterate over each server. + +Signed-off-by: Martin Kletzander +--- + src/libvirt_remote.syms | 1 + + src/rpc/virnetdaemon.c | 13 +++++++++++++ + src/rpc/virnetdaemon.h | 2 ++ + 3 files changed, 16 insertions(+) + +diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms +index e6ca041..6bfdcfa 100644 +--- a/src/libvirt_remote.syms ++++ b/src/libvirt_remote.syms +@@ -65,6 +65,7 @@ virNetDaemonAddSignalHandler; + virNetDaemonAutoShutdown; + virNetDaemonClose; + virNetDaemonGetServer; ++virNetDaemonHasClients; + virNetDaemonIsPrivileged; + virNetDaemonNew; + virNetDaemonNewPostExecRestart; +diff --git a/src/rpc/virnetdaemon.c b/src/rpc/virnetdaemon.c +index 67dff14..6b13282 100644 +--- a/src/rpc/virnetdaemon.c ++++ b/src/rpc/virnetdaemon.c +@@ -747,3 +747,16 @@ virNetDaemonClose(virNetDaemonPtr dmn) + + virObjectUnlock(dmn); + } ++ ++bool ++virNetDaemonHasClients(virNetDaemonPtr dmn) ++{ ++ size_t i = 0; ++ ++ for (i = 0; i < dmn->nservers; i++) { ++ if (virNetServerHasClients(dmn->servers[i])) ++ return true; ++ } ++ ++ return false; ++} +diff --git a/src/rpc/virnetdaemon.h b/src/rpc/virnetdaemon.h +index 9e176d6..bb32053 100644 +--- a/src/rpc/virnetdaemon.h ++++ b/src/rpc/virnetdaemon.h +@@ -76,6 +76,8 @@ void virNetDaemonQuit(virNetDaemonPtr dmn); + + void virNetDaemonClose(virNetDaemonPtr dmn); + ++bool virNetDaemonHasClients(virNetDaemonPtr dmn); ++ + virNetServerPtr virNetDaemonGetServer(virNetDaemonPtr dmn, + int subServerID); + +-- +2.4.3 + diff --git a/0001-rpc-Rework-timerActive-logic-in-daemon.patch b/0001-rpc-Rework-timerActive-logic-in-daemon.patch new file mode 100644 index 0000000..31b514f --- /dev/null +++ b/0001-rpc-Rework-timerActive-logic-in-daemon.patch @@ -0,0 +1,59 @@ +From b7ea58c262194037042284a14fb1608c9cf31884 Mon Sep 17 00:00:00 2001 +From: Martin Kletzander +Date: Fri, 10 Jul 2015 10:35:31 +0200 +Subject: [PATCH] rpc: Rework timerActive logic in daemon + +Daemon used false logic for determining whether there were any clients. +When the timer was inactive, it was activated if at least one of the +servers did not have clients. So the bool was being flipped there and +back all the time in case there was one client, for example. + +Initially introduced by fa1420736882. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1240283 + +Signed-off-by: Martin Kletzander +--- + src/rpc/virnetdaemon.c | 24 +++++++++--------------- + 1 file changed, 9 insertions(+), 15 deletions(-) + +diff --git a/src/rpc/virnetdaemon.c b/src/rpc/virnetdaemon.c +index 6b13282..910f266 100644 +--- a/src/rpc/virnetdaemon.c ++++ b/src/rpc/virnetdaemon.c +@@ -682,23 +682,17 @@ virNetDaemonRun(virNetDaemonPtr dmn) + */ + if (dmn->autoShutdownTimeout) { + if (timerActive) { +- for (i = 0; i < dmn->nservers; i++) { +- if (virNetServerHasClients(dmn->servers[i])) { +- VIR_DEBUG("Deactivating shutdown timer %d", timerid); +- virEventUpdateTimeout(timerid, -1); +- timerActive = false; +- break; +- } ++ if (virNetDaemonHasClients(dmn)) { ++ VIR_DEBUG("Deactivating shutdown timer %d", timerid); ++ virEventUpdateTimeout(timerid, -1); ++ timerActive = false; + } + } else { +- for (i = 0; i < dmn->nservers; i++) { +- if (!virNetServerHasClients(dmn->servers[i])) { +- VIR_DEBUG("Activating shutdown timer %d", timerid); +- virEventUpdateTimeout(timerid, +- dmn->autoShutdownTimeout * 1000); +- timerActive = true; +- break; +- } ++ if (!virNetDaemonHasClients(dmn)) { ++ VIR_DEBUG("Activating shutdown timer %d", timerid); ++ virEventUpdateTimeout(timerid, ++ dmn->autoShutdownTimeout * 1000); ++ timerActive = true; + } + } + } +-- +2.4.3 + diff --git a/libvirt.spec b/libvirt.spec index ae65b69..2603b3f 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -378,7 +378,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 1.2.17 -Release: 1%{?dist}%{?extra_release} +Release: 2%{?dist}%{?extra_release} License: LGPLv2+ Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -389,6 +389,12 @@ URL: http://libvirt.org/ %endif Source: http://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.gz +# Upstream commit 699faeacb10459fed748d425eb044ef69697e804. +Patch1: 0001-rpc-Add-virNetDaemonHasClients.patch + +# Upstream commit b7ea58c262194037042284a14fb1608c9cf31884. +Patch2: 0001-rpc-Rework-timerActive-logic-in-daemon.patch + %if %{with_libvirtd} Requires: libvirt-daemon = %{version}-%{release} %if %{with_network} @@ -2331,6 +2337,9 @@ exit 0 %doc examples/systemtap %changelog +* Wed Jul 29 2015 Richard W.M. Jones - 1.2.17-2 +- Fix 'Cannot write data: Broken pipe [code=38 domain=7]' (RHBZ#1247746). + * Tue Jul 14 2015 Cole Robinson - 1.2.17-1 - numerous improvements and refactoring of the parallels driver - hardening of vcpu code