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