aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Rabson <dfr@FreeBSD.org>2023-08-26 09:32:32 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2024-04-27 14:58:39 +0000
commit1d06b45463bf404b5010f2370cb39b68a32da323 (patch)
treea1b23ef658230f081a3f4f55c3a692428fd26a4b
parent90499f6efd57754563223bce1ec173669f1ce8a1 (diff)
downloadsrc-1d06b45463bf404b5010f2370cb39b68a32da323.tar.gz
src-1d06b45463bf404b5010f2370cb39b68a32da323.zip
Fix MNT_IGNORE for devfs, fdescfs and nullfs
The MNT_IGNORE flag can be used to mark certain filesystem mounts so that utilities such as df(1) and mount(8) can filter out those mounts by default. This can be used, for instance, to reduce the noise from running container workloads inside jails which often have at least three and sometimes as many as ten mounts per container. The flag is supplied by the nmount(2) system call and is recorded so that it can be reported by statfs(2). Unfortunately several filesystems override the default behaviour and mask out the flag, defeating its purpose. This change preserves the MNT_IGNORE flag for those filesystems so that it can be reported correctly. MFC after: 1 week (cherry picked from commit b5c4616582cebdcf4dee909a3c2f5b113c4ae59e)
-rw-r--r--sys/fs/devfs/devfs_vfsops.c2
-rw-r--r--sys/fs/fdescfs/fdesc_vfsops.c2
-rw-r--r--sys/fs/nullfs/null_vfsops.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/sys/fs/devfs/devfs_vfsops.c b/sys/fs/devfs/devfs_vfsops.c
index a81a63ebf27a..dbc29fbe4d78 100644
--- a/sys/fs/devfs/devfs_vfsops.c
+++ b/sys/fs/devfs/devfs_vfsops.c
@@ -224,7 +224,7 @@ static int
devfs_statfs(struct mount *mp, struct statfs *sbp)
{
- sbp->f_flags = 0;
+ sbp->f_flags = mp->mnt_flag & MNT_IGNORE;
sbp->f_bsize = DEV_BSIZE;
sbp->f_iosize = DEV_BSIZE;
sbp->f_blocks = 2; /* 1K to keep df happy */
diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c
index 309134798374..30924580dece 100644
--- a/sys/fs/fdescfs/fdesc_vfsops.c
+++ b/sys/fs/fdescfs/fdesc_vfsops.c
@@ -219,7 +219,7 @@ fdesc_statfs(struct mount *mp, struct statfs *sbp)
freefd += (lim - fdp->fd_nfiles);
FILEDESC_SUNLOCK(fdp);
- sbp->f_flags = 0;
+ sbp->f_flags = mp->mnt_flag & MNT_IGNORE;
sbp->f_bsize = DEV_BSIZE;
sbp->f_iosize = DEV_BSIZE;
sbp->f_blocks = 2; /* 1K to keep df happy */
diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c
index 77ead04b1616..271f5bf249fc 100644
--- a/sys/fs/nullfs/null_vfsops.c
+++ b/sys/fs/nullfs/null_vfsops.c
@@ -337,7 +337,7 @@ nullfs_statfs(struct mount *mp, struct statfs *sbp)
/* now copy across the "interesting" information and fake the rest */
sbp->f_type = mstat->f_type;
sbp->f_flags = (sbp->f_flags & (MNT_RDONLY | MNT_NOEXEC | MNT_NOSUID |
- MNT_UNION | MNT_NOSYMFOLLOW | MNT_AUTOMOUNTED)) |
+ MNT_UNION | MNT_NOSYMFOLLOW | MNT_AUTOMOUNTED | MNT_IGNORE)) |
(mstat->f_flags & ~(MNT_ROOTFS | MNT_AUTOMOUNTED));
sbp->f_bsize = mstat->f_bsize;
sbp->f_iosize = mstat->f_iosize;