]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_quota: fix missing mount point warning
authorPavel Reichl <preichl@redhat.com>
Wed, 11 Oct 2023 20:50:54 +0000 (22:50 +0200)
committerCarlos Maiolino <cem@kernel.org>
Tue, 21 Nov 2023 13:09:36 +0000 (14:09 +0100)
When user have mounted an XFS volume, and defined project in
/etc/projects file that points to a directory on a different volume,
then:
`xfs_quota -xc "report -a" $path_to_mounted_volume'

complains with:
"xfs_quota: cannot find mount point for path \
`directory_from_projects': Invalid argument"

unlike `xfs_quota -xc "report -a"' which works as expected and no
warning is printed.

This is happening because in the 1st call we pass to xfs_quota command
the $path_to_mounted_volume argument which says to xfs_quota not to
look for all mounted volumes on the system, but use only those passed
to the command and ignore all others (This behavior is intended as an
optimization for systems with huge number of mounted volumes). After
that, while projects are initialized, the project's directories on
other volumes are obviously not in searched subset of volumes and
warning is printed.

I propose to fix this behavior by conditioning the printing of warning
only if all mounted volumes are searched.

Signed-off-by: Pavel Reichl <preichl@redhat.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
libfrog/paths.c

index abb29a237e80684ea9541abc9f73c405dedf6858..d8c42163a7bc850af61f8ce9923bb339bbbcedee 100644 (file)
@@ -457,7 +457,8 @@ fs_table_insert_mount(
 
 static int
 fs_table_initialise_projects(
-       char            *project)
+       char            *project,
+       bool            all_mps_initialised)
 {
        fs_project_path_t *path;
        fs_path_t       *fs;
@@ -473,8 +474,10 @@ fs_table_initialise_projects(
                        continue;
                fs = fs_mount_point_from_path(path->pp_pathname);
                if (!fs) {
-                       fprintf(stderr, _("%s: cannot find mount point for path `%s': %s\n"),
-                                       progname, path->pp_pathname, strerror(errno));
+                       if (all_mps_initialised)
+                               fprintf(stderr,
+       _("%s: cannot find mount point for path `%s': %s\n"), progname,
+                                       path->pp_pathname, strerror(errno));
                        continue;
                }
                (void) fs_table_insert(path->pp_pathname, path->pp_prid,
@@ -495,11 +498,12 @@ fs_table_initialise_projects(
 
 static void
 fs_table_insert_project(
-       char            *project)
+       char            *project,
+       bool            all_mps_initialised)
 {
        int             error;
 
-       error = fs_table_initialise_projects(project);
+       error = fs_table_initialise_projects(project, all_mps_initialised);
        if (error)
                fprintf(stderr, _("%s: cannot setup path for project %s: %s\n"),
                        progname, project, strerror(error));
@@ -532,9 +536,9 @@ fs_table_initialise(
        }
        if (project_count) {
                for (i = 0; i < project_count; i++)
-                       fs_table_insert_project(projects[i]);
+                       fs_table_insert_project(projects[i], mount_count == 0);
        } else {
-               error = fs_table_initialise_projects(NULL);
+               error = fs_table_initialise_projects(NULL, mount_count == 0);
                if (error)
                        goto out_error;
        }