forked from pool/libvirt
37e0137a03
Tue Jul 10 13:29:51 UTC 2015 - cbosdonnat@suse.com - Fixed virt-aa-helper bugs preventing virt-sandbox to work. 24f3c2f-virt-aa-helper-fix-caps.patch 61dab0f-virt-aa-helper-renaming.patch a55a5e7-virt-aa-helper-log.patch e44bcae-virt-aa-helper-trailing-slash.patch bsc#936841 - Fixed crasher due to uninitialized values qemu-nbd-cleanup-fix.patch bsc#936841 OBS-URL: https://build.opensuse.org/request/show/315860 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=470
56 lines
1.7 KiB
Diff
56 lines
1.7 KiB
Diff
From 1f17be07e9fbbae6fdba6842546ca86d51f84447 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= <cbosdonnat@suse.com>
|
|
Date: Thu, 9 Jul 2015 16:23:08 +0200
|
|
Subject: [PATCH 5/5] Fix qemu-nbd cleanup crashes
|
|
|
|
The virLXCControllerAppendNBDPids function didn't properly initialize
|
|
pids and npids. In case of failure it was crashing when freeing those.
|
|
|
|
The nbd device pid file doesn't appear immediately after starting
|
|
qemu-nbd: adding a small loop to wait for it.
|
|
---
|
|
src/lxc/lxc_controller.c | 19 +++++++++++++++++--
|
|
1 file changed, 17 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
|
|
index 828b8a8..78d3eee 100644
|
|
--- a/src/lxc/lxc_controller.c
|
|
+++ b/src/lxc/lxc_controller.c
|
|
@@ -533,16 +533,31 @@ static int virLXCControllerAppendNBDPids(virLXCControllerPtr ctrl,
|
|
const char *dev)
|
|
{
|
|
char *pidpath = NULL;
|
|
- pid_t *pids;
|
|
- size_t npids;
|
|
+ pid_t *pids = NULL;
|
|
+ size_t npids = 0;
|
|
size_t i;
|
|
int ret = -1;
|
|
+ size_t loops = 0;
|
|
pid_t pid;
|
|
|
|
if (!STRPREFIX(dev, "/dev/") ||
|
|
virAsprintf(&pidpath, "/sys/devices/virtual/block/%s/pid", dev + 5) < 0)
|
|
goto cleanup;
|
|
|
|
+ /* Wait for the pid file to appear */
|
|
+ while (!virFileExists(pidpath)) {
|
|
+ /* wait for 100ms before checking again, but don't do it for ever */
|
|
+ if (errno == ENOENT && loops < 10) {
|
|
+ usleep(100 * 1000);
|
|
+ loops++;
|
|
+ } else {
|
|
+ virReportSystemError(errno,
|
|
+ _("Cannot check NBD device %s pid"),
|
|
+ dev + 5);
|
|
+ goto cleanup;
|
|
+ }
|
|
+ }
|
|
+
|
|
if (virPidFileReadPath(pidpath, &pid) < 0)
|
|
goto cleanup;
|
|
|
|
--
|
|
2.1.4
|
|
|