Date: Sat, 24 Jul 2021 20:39:18 GMT From: "Jason A. Harmening" <jah@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 2bc16e8aaf75 - main - VFS: remove MNTK_MARKER Message-ID: <202107242039.16OKdIdr011461@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=2bc16e8aaf7577e702ce1dbcb343f11c53e8dce0 commit 2bc16e8aaf7577e702ce1dbcb343f11c53e8dce0 Author: Jason A. Harmening <jah@FreeBSD.org> AuthorDate: 2021-07-18 04:26:48 +0000 Commit: Jason A. Harmening <jah@FreeBSD.org> CommitDate: 2021-07-24 19:52:32 +0000 VFS: remove MNTK_MARKER We no longer allow upper filesystems to be unregistered from the base mount while vfs_notify_upper() or any other upper operation is pending. New upper mounts can still be registered during this period, but they will be added at the end of the upper mount tailq. We therefore no longer need to allocate marker nodes during vfs_notify_upper() to keep our place in the iteration. Reviewed by: kib, mckusick Tested by: pho Differential Revision: https://reviews.freebsd.org/D31016 --- sys/kern/vfs_subr.c | 34 ++-------------------------------- sys/sys/mount.h | 1 - 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 8add6951645f..23f6ec9cf3fd 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -3891,52 +3891,26 @@ vgone(struct vnode *vp) VI_UNLOCK(vp); } -static void -notify_lowervp_vfs_dummy(struct mount *mp __unused, - struct vnode *lowervp __unused) -{ -} - -struct notify_mount { - struct mount mp; - struct mount_upper_node upper; -}; - /* * Notify upper mounts about reclaimed or unlinked vnode. */ void vfs_notify_upper(struct vnode *vp, int event) { - static struct vfsops vgonel_vfsops = { - .vfs_reclaim_lowervp = notify_lowervp_vfs_dummy, - .vfs_unlink_lowervp = notify_lowervp_vfs_dummy, - }; struct mount *mp; struct mount_upper_node *ump; - struct notify_mount *mmp; - mp = vp->v_mount; + mp = atomic_load_ptr(&vp->v_mount); if (mp == NULL) return; if (TAILQ_EMPTY(&mp->mnt_notify)) return; - mmp = malloc(sizeof(*mmp), M_TEMP, M_WAITOK | M_ZERO); - mmp->mp.mnt_op = &vgonel_vfsops; - mmp->mp.mnt_kern_flag |= MNTK_MARKER; - mmp->upper.mp = &mmp->mp; MNT_ILOCK(mp); mp->mnt_upper_pending++; KASSERT(mp->mnt_upper_pending > 0, ("%s: mnt_upper_pending %d", __func__, mp->mnt_upper_pending)); - for (ump = TAILQ_FIRST(&mp->mnt_notify); ump != NULL;) { - if ((ump->mp->mnt_kern_flag & MNTK_MARKER) != 0) { - ump = TAILQ_NEXT(ump, mnt_upper_link); - continue; - } - TAILQ_INSERT_AFTER(&mp->mnt_notify, ump, &mmp->upper, - mnt_upper_link); + TAILQ_FOREACH(ump, &mp->mnt_notify, mnt_upper_link) { MNT_IUNLOCK(mp); switch (event) { case VFS_NOTIFY_UPPER_RECLAIM: @@ -3950,10 +3924,7 @@ vfs_notify_upper(struct vnode *vp, int event) break; } MNT_ILOCK(mp); - ump = TAILQ_NEXT(&mmp->upper, mnt_upper_link); - TAILQ_REMOVE(&mp->mnt_notify, &mmp->upper, mnt_upper_link); } - free(mmp, M_TEMP); mp->mnt_upper_pending--; if ((mp->mnt_kern_flag & MNTK_UPPER_WAITER) != 0 && mp->mnt_upper_pending == 0) { @@ -4391,7 +4362,6 @@ DB_SHOW_COMMAND(mount, db_show_mount) MNT_KERN_FLAG(MNTK_RECURSE); MNT_KERN_FLAG(MNTK_UPPER_WAITER); MNT_KERN_FLAG(MNTK_LOOKUP_EXCL_DOTDOT); - MNT_KERN_FLAG(MNTK_MARKER); MNT_KERN_FLAG(MNTK_USES_BCACHE); MNT_KERN_FLAG(MNTK_FPLOOKUP); MNT_KERN_FLAG(MNTK_TASKQUEUE_WAITER); diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 2082ff089d69..016c7e9c188d 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -488,7 +488,6 @@ struct mntoptnames { #define MNTK_RECURSE 0x00000200 /* pending recursive unmount */ #define MNTK_UPPER_WAITER 0x00000400 /* waiting to drain MNTK_UPPER_PENDING */ #define MNTK_LOOKUP_EXCL_DOTDOT 0x00000800 -#define MNTK_MARKER 0x00001000 #define MNTK_UNMAPPED_BUFS 0x00002000 #define MNTK_USES_BCACHE 0x00004000 /* FS uses the buffer cache. */ #define MNTK_TEXT_REFS 0x00008000 /* Keep use ref for text */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107242039.16OKdIdr011461>