flt.lttng-utils.debug-info: fd-cache: log to `debug` severity on stat() error
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Wed, 8 May 2019 15:43:02 +0000 (11:43 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 8 May 2019 18:11:25 +0000 (14:11 -0400)
Issue
=====
A `debug-info` component tries to open multiple files in its search to
find the debugging information necessary to resolve the addresses
contained in the trace.

Early in the `bt_fd_cache_get_handle()` function, a `stat()`
is done on the path to get the inode number and device number. This
`stat()` returns an error if the file is absent. Currently, in those
cases, an message is logged at the `error` severity level (BT_LOGE_*)
resulting in the printing of an error message. Since multiple files are
tired until the right one is found (if any), the user can see multiple
error messages even if the right file may be found later.

This is undesirable because it mislead the user into thinking that an
error occurred when in fact it's completely normal.

Solution
========
Log the failure of this `stat()` call to the `debug` severity level.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: If81f4333374e6ee95b4dea07924c3d37f0e3b652
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1276
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
fd-cache/fd-cache.c

index dcb4f59802e9bd5460236ac377c7da055ef4323b..e12583a08743869a3265462cc4cd87c877d81de1 100644 (file)
@@ -139,13 +139,18 @@ struct bt_fd_cache_handle *bt_fd_cache_get_handle(struct bt_fd_cache *fdc,
 
        ret = stat(path, &statbuf);
        if (ret < 0) {
-               BT_LOGE_ERRNO("Failed to stat file", ": path=%s", path);
+               /*
+                * This is not necessarily an error as we sometimes try to open
+                * files to see if they exist. Log the error as DEBUG severity
+                * level.
+                */
+               BT_LOGD_ERRNO("Failed to stat file", ": path=%s", path);
                goto end;
        }
 
        /*
         * Use the device number and inode number to uniquely identify a file.
-        * Even if the file as the same path, it may have been replaced so we
+        * Even if the file has the same path, it may have been replaced so we
         * must open a new FD for it. This replacement of file is more likely
         * to happen with a lttng-live source component.
         */
This page took 0.026472 seconds and 4 git commands to generate.