Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Apr 2024 13:48:38 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: a1e55af8d123 - stable/14 - Fix MNT_IGNORE for devfs, fdescfs and nullfs
Message-ID:  <202404221348.43MDmcnk021949@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=a1e55af8d12398ae43725ff6987b2fdbb2044fd2

commit a1e55af8d12398ae43725ff6987b2fdbb2044fd2
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-22 13:48:15 +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 262a6793b285..5114fa0b50ae 100644
--- a/sys/fs/nullfs/null_vfsops.c
+++ b/sys/fs/nullfs/null_vfsops.c
@@ -372,7 +372,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?202404221348.43MDmcnk021949>