Whamcloud - gitweb
LU-11881 utils: silence error message 86/34086/2
authorAlexander Zarochentsev <c17826@cray.com>
Sun, 15 Jul 2018 21:17:20 +0000 (00:17 +0300)
committerOleg Drokin <green@whamcloud.com>
Mon, 11 Feb 2019 03:22:43 +0000 (03:22 +0000)
llapi_get_poollist prints an error message
in case of reallocating the buffer
and successful completion.

Cray-bug-id: LUS-6185
Test-Parameters: testlist=ost-pools
Change-Id: I0ca1f25edf3f4c89525d41f2deab8d25ec9e0516
Signed-off-by: Alexander Zarochentsev <c17826@cray.com>
Reviewed-on: https://review.whamcloud.com/34086
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Alexandr Boyko <c17825@cray.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/utils/liblustreapi.c

index 78dc8a5..bb1bf98 100644 (file)
@@ -1520,7 +1520,6 @@ int llapi_get_poollist(const char *name, char **poollist, int list_size,
                goto free_path;
        }
 
                goto free_path;
        }
 
-       llapi_printf(LLAPI_MSG_NORMAL, "Pools from %s:\n", fsname);
        dir = opendir(pathname.gl_pathv[0]);
        if (dir == NULL) {
                rc = -errno;
        dir = opendir(pathname.gl_pathv[0]);
        if (dir == NULL) {
                rc = -errno;
@@ -1545,14 +1544,14 @@ int llapi_get_poollist(const char *name, char **poollist, int list_size,
                 /* check output bounds */
                if (nb_entries >= list_size) {
                        rc = -EOVERFLOW;
                 /* check output bounds */
                if (nb_entries >= list_size) {
                        rc = -EOVERFLOW;
-                       goto free_dir;
+                       goto free_dir_no_msg;
                }
 
                 /* +2 for '.' and final '\0' */
                if (used + strlen(pool->d_name) + strlen(fsname) + 2
                    > buffer_size) {
                        rc = -EOVERFLOW;
                }
 
                 /* +2 for '.' and final '\0' */
                if (used + strlen(pool->d_name) + strlen(fsname) + 2
                    > buffer_size) {
                        rc = -EOVERFLOW;
-                       goto free_dir;
+                       goto free_dir_no_msg;
                }
 
                sprintf(buffer + used, "%s.%s", fsname, pool->d_name);
                }
 
                sprintf(buffer + used, "%s.%s", fsname, pool->d_name);
@@ -1565,6 +1564,10 @@ free_dir:
        if (rc)
                llapi_error(LLAPI_MSG_ERROR, rc,
                            "Error reading pool list for '%s'", name);
        if (rc)
                llapi_error(LLAPI_MSG_ERROR, rc,
                            "Error reading pool list for '%s'", name);
+       else
+               llapi_printf(LLAPI_MSG_NORMAL, "Pools from %s:\n", fsname);
+
+free_dir_no_msg:
        closedir(dir);
 free_path:
        cfs_free_param_data(&pathname);
        closedir(dir);
 free_path:
        cfs_free_param_data(&pathname);