diff options
author | Bill O'Donnell <billodo@redhat.com> | 2016-09-19 16:02:22 +1000 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2016-09-19 16:02:22 +1000 |
commit | bb80e3d6cd0470d268921bce96e4c6bc27d7f7b8 (patch) | |
tree | fd8a6f5fe97b3fc5988885f2fb625c916b612744 /quota | |
parent | b04647edea32dbbce0fc12ea6f54a8da706a2265 (diff) | |
download | xfsprogs-dev-bb80e3d6cd0470d268921bce96e4c6bc27d7f7b8.tar.gz |
libxcmd: populate fs table with xfs entries first, foreign entries last
Commits b20b6c2 and 29647c8 modified xfs_quota for use on
non-XFS filesystems. Modifications to fs_initialise_mounts
(paths.c) resulted in an xfstest fail (xfs/261), due to foreign
fs paths being picked up first from the fs table. The xfs_quota
print command then complained about not being able to print the
foreign paths, instead of previous behavior (quiet).
This patch restores correct behavior, sorting the table so that
xfs entries are first, followed by foreign fs entries. The patch
maintains the order of xfs entries and foreign entries in the
same order as mtab entries. Then, in functions which print all
paths we can simply break at the first foreign path if the -f
switch is not specified.
Signed-off-by: Bill O'Donnell <billodo@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'quota')
-rw-r--r-- | quota/path.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/quota/path.c b/quota/path.c index a623d2551d..01ccab4f68 100644 --- a/quota/path.c +++ b/quota/path.c @@ -75,9 +75,15 @@ static int pathlist_f(void) { int i; + struct fs_path *path; - for (i = 0; i < fs_count; i++) - printpath(&fs_table[i], i, 1, &fs_table[i] == fs_path); + for (i = 0; i < fs_count; i++) { + path = &fs_table[i]; + /* Table is ordered xfs first, then foreign */ + if (path->fs_flags & FS_FOREIGN && !foreign_allowed) + break; + printpath(path, i, 1, path == fs_path); + } return 0; } @@ -87,9 +93,14 @@ print_f( char **argv) { int i; + struct fs_path *path; - for (i = 0; i < fs_count; i++) - printpath(&fs_table[i], i, 0, 0); + for (i = 0; i < fs_count; i++) { + path = &fs_table[i]; + if (path->fs_flags & FS_FOREIGN && !foreign_allowed) + break; + printpath(path, i, 0, 0); + } return 0; } @@ -99,6 +110,7 @@ path_f( char **argv) { int i; + int max = foreign_allowed ? fs_count : xfs_fs_count; if (fs_count == 0) { printf(_("No paths are available\n")); @@ -109,9 +121,9 @@ path_f( return pathlist_f(); i = atoi(argv[1]); - if (i < 0 || i >= fs_count) { + if (i < 0 || i >= max) { printf(_("value %d is out of range (0-%d)\n"), - i, fs_count-1); + i, max - 1); } else { fs_path = &fs_table[i]; pathlist_f(); |