When getting mount information for all filesystems, mount uses the

getfsstat(2) system call using the MNT_NOWAIT flag to indicate that
it wants to use the statfs information cached in the mount structure.
When the -v (verbose) flag is specified, we need to use the MNT_WAIT
flag to getfsstat(2) so that kernel will call VFS_STATFS to get the
current statfs statistics from each filesystem.

Sponsored by:	Netflix
This commit is contained in:
mckusick 2018-08-07 21:17:45 +00:00
parent 4ef74e60b2
commit 2d7cd4e947

View File

@ -329,7 +329,8 @@ main(int argc, char *argv[])
rval = 0;
switch (argc) {
case 0:
if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
if ((mntsize = getmntinfo(&mntbuf,
verbose ? MNT_WAIT : MNT_NOWAIT)) == 0)
err(1, "getmntinfo");
if (all) {
while ((fs = getfsent()) != NULL) {