d759b5
From 89288ed330ea3afb25547e7809ea1df3d4a857bd Mon Sep 17 00:00:00 2001
d759b5
Message-Id: <89288ed330ea3afb25547e7809ea1df3d4a857bd@dist-git>
e00e43
From: Peter Krempa <pkrempa@redhat.com>
e00e43
Date: Wed, 9 Oct 2019 14:27:45 +0200
e00e43
Subject: [PATCH] util: command: Ignore bitmap errors when enumerating file
e00e43
 descriptors to close
e00e43
e00e43
virCommandMassCloseGetFDsLinux fails when running libvird on valgrind
e00e43
with the following message:
e00e43
e00e43
libvirt:  error : internal error: unable to set FD as open: 1024
e00e43
e00e43
This is because valgrind opens few file descriptors beyond the limit:
e00e43
e00e43
65701125 lr-x------. 1 root root 64 Jul 18 14:48 1024 -> /home/pipo/build/libvirt/gcc/src/.libs/libvirtd
e00e43
65701126 lrwx------. 1 root root 64 Jul 18 14:48 1025 -> '/tmp/valgrind_proc_3849_cmdline_186612e3 (deleted)'
e00e43
65701127 lrwx------. 1 root root 64 Jul 18 14:48 1026 -> '/tmp/valgrind_proc_3849_auxv_186612e3 (deleted)'
e00e43
65701128 lrwx------. 1 root root 64 Jul 18 14:48 1027 -> /dev/pts/11
e00e43
65701129 lr-x------. 1 root root 64 Jul 18 14:48 1028 -> 'pipe:[65689522]'
e00e43
65701130 l-wx------. 1 root root 64 Jul 18 14:48 1029 -> 'pipe:[65689522]'
e00e43
65701131 lr-x------. 1 root root 64 Jul 18 14:48 1030 -> /tmp/vgdb-pipe-from-vgdb-to-3849-by-root-on-angien
e00e43
e00e43
Ignore bitmap errors in this case since we'd leak those FD's anyways in
e00e43
the previous scenario.
e00e43
e00e43
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
e00e43
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
e00e43
(cherry picked from commit 728343983787cbd4d7ae8fa2007a157bb140f02a)
e00e43
e00e43
https://bugzilla.redhat.com/show_bug.cgi?id=1759904
e00e43
e00e43
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
e00e43
Message-Id: <30a3508e2903b58e695d467844f6d84cd008a0d9.1570623892.git.mprivozn@redhat.com>
e00e43
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
e00e43
---
e00e43
 src/util/vircommand.c | 7 +------
e00e43
 1 file changed, 1 insertion(+), 6 deletions(-)
e00e43
e00e43
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
e00e43
index 2d0c987fe2..17405ceea4 100644
e00e43
--- a/src/util/vircommand.c
e00e43
+++ b/src/util/vircommand.c
e00e43
@@ -520,12 +520,7 @@ virCommandMassCloseGetFDsLinux(virCommandPtr cmd ATTRIBUTE_UNUSED,
e00e43
             goto cleanup;
e00e43
         }
e00e43
 
e00e43
-        if (virBitmapSetBit(fds, fd) < 0) {
e00e43
-            virReportError(VIR_ERR_INTERNAL_ERROR,
e00e43
-                           _("unable to set FD as open: %d"),
e00e43
-                           fd);
e00e43
-            goto cleanup;
e00e43
-        }
e00e43
+        ignore_value(virBitmapSetBit(fds, fd));
e00e43
     }
e00e43
 
e00e43
     if (rc < 0)
e00e43
-- 
e00e43
2.23.0
e00e43