From a7ac2d3a5ccecefdce33b92ba4a259a1637f5985 Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Wed, 8 May 2019 11:43:02 -0400 Subject: [PATCH] flt.lttng-utils.debug-info: fd-cache: log to `debug` severity on stat() error MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Change-Id: If81f4333374e6ee95b4dea07924c3d37f0e3b652 Reviewed-on: https://review.lttng.org/c/babeltrace/+/1276 Reviewed-by: Jérémie Galarneau --- fd-cache/fd-cache.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fd-cache/fd-cache.c b/fd-cache/fd-cache.c index dcb4f598..e12583a0 100644 --- a/fd-cache/fd-cache.c +++ b/fd-cache/fd-cache.c @@ -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. */ -- 2.34.1