]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: Make virFileClose() quiet on success
authorAndrea Bolognani <abologna@redhat.com>
Thu, 12 Nov 2020 18:42:00 +0000 (19:42 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Mon, 16 Nov 2020 08:18:03 +0000 (09:18 +0100)
While it's certainly good to log events like "failed to close fd"
and "tried to close invalid fd", which are likely to be the
consequence of some bug in libvirt, logging a message every single
time a file descriptor is closed successfully is perhaps excessive
and can lead to useful information being missed among the noise.

Log filters don't help in this situation, because filtering out all
of util.file is too big a hammer and would cause important messages
to be left out as well.

To give an idea of just how much noise this single debug statement
can cause, here's a real life example from a quite large libvirtd
log I had to look at recently:

  $ grep virFile libvirt.log | wc -l
  1307
  $ grep virFile libvirt.log | grep -v 'Closed fd' | wc -l
  343

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/util/virfile.c

index 9a7dcfc9a66dac3aa8bcfd9e0048f9a1acb081c9..f57272ca2f70568e5ea62d06a9e3d77854a5e013 100644 (file)
@@ -131,8 +131,6 @@ int virFileClose(int *fdptr, virFileCloseFlags flags)
                 VIR_DEBUG("Failed to close fd %d: %s",
                           *fdptr, g_strerror(errno));
             }
-        } else {
-            VIR_DEBUG("Closed fd %d", *fdptr);
         }
     }
     *fdptr = -1;