Date: Sat, 27 Apr 2024 14:58:45 GMT From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= <des@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 1d06b45463bf - stable/13 - Fix MNT_IGNORE for devfs, fdescfs and nullfs Message-ID: <202404271458.43REwjHI032475@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=1d06b45463bf404b5010f2370cb39b68a32da323 commit 1d06b45463bf404b5010f2370cb39b68a32da323 Author: Doug Rabson <dfr@FreeBSD.org> AuthorDate: 2023-08-26 09:32:32 +0000 Commit: Dag-Erling Smørgrav <des@FreeBSD.org> CommitDate: 2024-04-27 14:58:39 +0000 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) --- sys/fs/devfs/devfs_vfsops.c | 2 +- sys/fs/fdescfs/fdesc_vfsops.c | 2 +- sys/fs/nullfs/null_vfsops.c | 2 +- 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202404271458.43REwjHI032475>