From 4818bd986c8954a9f112de832490a8dc7190baf3 Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Tue, 7 Aug 2018 21:17:45 +0000 Subject: [PATCH] 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 --- sbin/mount/mount.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index 6a59c736088e..a44a6fe8571f 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -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) {