Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 03 May 2026 20:12:32 +0000
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 9ca9a79ea67e - main - Revert erronously pushed series of commits, which should not be.
Message-ID:  <69f7ac30.42c23.2250bb73@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by kib:

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

commit 9ca9a79ea67e8569c31ecc328e001b35908f491c
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-05-03 20:10:06 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-05-03 20:12:03 +0000

    Revert erronously pushed series of commits, which should not be.
    
    Sorry for the mess.
    
    Revert "sys/vnode.h: remove stale comment"
    This reverts commit f193f5a749b696e6c05fa2c47c24522b1624b1a7.
    
    Revert "vfs: convert VFS_OPs from macros to static inlines"
    This reverts commit 48bf024f2ef5afeba3500bd92a04283370479edf.
    
    Revert "vnode: add VIRF_KNOTE flag"
    This reverts commit 7fe74a02764e5899b10cdc45ab34182b961d5d19.
    
    Revert "vfs: convert vfs_op_thread_* macros to static inlines"
    This reverts commit a61a696e78a967b149a6e39b1f98ada26217a6bb.
    
    Revert "struct vnode: assign v_rl.resv1 as v_vrflag"
    This reverts commit d990e8f0e9478194569ba28c366b0c0c0f414e7b.
    
    Revert "sys/rangelock.h: explicitly enumerate padding at the end of the structure"
    This reverts commit a770638ecf16515d8922111c3fdd417aba6c045e.
    
    Revert "bufspace_wait(): only try to help bufdaemon if there is a chance to help"
    This reverts commit 067cfac2e7bd9dc857fb6cc504c01b0249bcd1b7.
    
    Revert "Add O_SYMLINK emulation"
    This reverts commit f9458655e78f6532e962a13d28d6a6086b4156de.
    
    Revert "libc: add freadlink(3)"
    This reverts commit ae6a13deb8e33a52188643e09171207e1d7171e8.
    
    Revert "Add O_SYMLINK emulation"
    This reverts commit 2213820b6f4cd22bbfdc0f45741c3e7d17ae82c0.
---
 include/unistd.h                 |   1 -
 lib/libc/gen/Makefile.inc        |   1 -
 lib/libc/gen/Symbol.map          |   1 -
 lib/libc/gen/freadlink.c         |  16 --
 lib/libc/include/libc_private.h  |   3 -
 lib/libc/sys/Symbol.map          |   4 -
 lib/libc/sys/open.c              |   4 +-
 lib/libc/sys/openat.c            |  44 +-----
 lib/libthr/thread/thr_syscalls.c |   5 +-
 sys/kern/vfs_bio.c               |   3 +-
 sys/kern/vfs_cache.c             |   4 +-
 sys/kern/vfs_mount.c             |   6 +-
 sys/kern/vfs_subr.c              |  57 +++----
 sys/kern/vfs_vnops.c             |   4 +-
 sys/sys/fcntl.h                  |   7 -
 sys/sys/mount.h                  | 323 +++++++++++++++++----------------------
 sys/sys/rangelock.h              |   6 -
 sys/sys/vnode.h                  |  28 ++--
 18 files changed, 188 insertions(+), 329 deletions(-)

diff --git a/include/unistd.h b/include/unistd.h
index 290bcce6a0b3..797eac4c364d 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -518,7 +518,6 @@ int	 execvpe(const char *, char * const *, char * const *);
 int	 feature_present(const char *);
 int	 fchroot(int);
 char	*fflagstostr(u_long);
-ssize_t	 freadlink(int fd, char *buf, size_t bufsize);
 int	 getdomainname(char *, int);
 int	 getentropy(void *, size_t);
 int	 getgrouplist(const char *, gid_t, gid_t *, int *);
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index 18a68902f50a..c31f789fd1d1 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -56,7 +56,6 @@ SRCS+= \
 	fmtmsg.c \
 	fnmatch.c \
 	fpclassify.c \
-	freadlink.c \
 	frexp.c \
 	fstab.c \
 	ftok.c \
diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map
index 4d22251f7ec5..60f34b3a1923 100644
--- a/lib/libc/gen/Symbol.map
+++ b/lib/libc/gen/Symbol.map
@@ -475,7 +475,6 @@ FBSD_1.8 {
 };
 
 FBSD_1.9 {
-	freadlink;
 	posix_spawn_file_actions_addchdir;
 	posix_spawn_file_actions_addfchdir;
 	posix_spawnattr_getexecfd_np;
diff --git a/lib/libc/gen/freadlink.c b/lib/libc/gen/freadlink.c
deleted file mode 100644
index e1ed7aba6c06..000000000000
--- a/lib/libc/gen/freadlink.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
- * Copyright 2026 The FreeBSD Foundation
- *
- * This software were developed by Konstantin Belousov <kib@FreeBSD.org>
- * under sponsorship from the FreeBSD Foundation.
- */
-
-#include <unistd.h>
-
-ssize_t
-freadlink(int fd, char *buf, size_t bufsize)
-{
-	return (readlinkat(fd, "", buf, bufsize));
-}
diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h
index ef490e1a66ef..299629fce2ad 100644
--- a/lib/libc/include/libc_private.h
+++ b/lib/libc/include/libc_private.h
@@ -384,7 +384,4 @@ struct uexterror;
 int __uexterr_format(const struct uexterror *ue, char *buf, size_t bufsz);
 int __libc_uexterr_gettext(char *buf, size_t bufsz);
 
-int __impl_openat(int fd, const char *path, int flags, ...);
-int __openat_symlink(int fd, const char *path, int flags, int interposed);
-
 #endif /* _LIBC_PRIVATE_H_ */
diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map
index 1bae1fb78538..8acffcfd714e 100644
--- a/lib/libc/sys/Symbol.map
+++ b/lib/libc/sys/Symbol.map
@@ -75,7 +75,3 @@ FBSD_1.7 {
 FBSD_1.9 {
 	pdwait;
 };
-
-FBSDprivate_1.0 {
-	__openat_symlink;
-};
diff --git a/lib/libc/sys/open.c b/lib/libc/sys/open.c
index d58a81f60b18..dd7bedebf141 100644
--- a/lib/libc/sys/open.c
+++ b/lib/libc/sys/open.c
@@ -29,11 +29,9 @@
  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "namespace.h"
 #include <sys/types.h>
 #include <sys/fcntl.h>
 #include <stdarg.h>
-#include "un-namespace.h"
 #include "libc_private.h"
 
 #pragma weak open
@@ -50,5 +48,5 @@ open(const char *path, int flags, ...)
 	} else {
 		mode = 0;
 	}
-	return (__impl_openat(AT_FDCWD, path, flags, mode));
+	return (INTERPOS_SYS(openat, AT_FDCWD, path, flags, mode));
 }
diff --git a/lib/libc/sys/openat.c b/lib/libc/sys/openat.c
index f4223be8aad7..ba937cae3a3e 100644
--- a/lib/libc/sys/openat.c
+++ b/lib/libc/sys/openat.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014, 2026 The FreeBSD Foundation.
+ * Copyright (c) 2014 The FreeBSD Foundation.
  *
  * Portions of this software were developed by Konstantin Belousov
  * under sponsorship from the FreeBSD Foundation.
@@ -29,46 +29,11 @@
  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "namespace.h"
 #include <sys/types.h>
 #include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
 #include <stdarg.h>
-#include <unistd.h>
-#include "un-namespace.h"
 #include "libc_private.h"
 
-static int
-do_openat(int fd, const char *path, int flags, int interposed)
-{
-	if (interposed)
-		return (__sys_openat(fd, path, flags | O_PATH, 0));
-	return (INTERPOS_SYS(openat, fd, path, flags | O_PATH, 0));
-}
-
-int
-__openat_symlink(int fd, const char *path, int flags, int interposed)
-{
-	struct stat st;
-	int rfd, xfd, saved_errno;
-
-	flags &= ~O_SYMLINK;
-	rfd = do_openat(fd, path, flags | O_PATH | O_NOFOLLOW, interposed);
-	if (rfd != -1 && _fstat(rfd, &st) != -1 && !S_ISLNK(st.st_mode)) {
-		xfd = do_openat(rfd, "", flags | O_EMPTY_PATH, interposed);
-		saved_errno = errno;
-		/* dup to rfd to guarantee lowest fd number value */
-		if (_dup2(xfd, rfd) == -1) {
-			_close(rfd);
-			rfd = -1;
-		}
-		_close(xfd);
-		errno = saved_errno;
-	}
-	return (rfd);
-}
-
 __sym_compat(openat, __impl_openat, FBSD_1.1);
 __weak_reference(openat, __impl_openat);
 __sym_default(openat, openat, FBSD_1.2);
@@ -80,19 +45,12 @@ openat(int fd, const char *path, int flags, ...)
 	va_list ap;
 	int mode;
 
-	if (__predict_false((flags & (O_SYMLINK | O_CREAT)) ==
-	    (O_SYMLINK | O_CREAT))) {
-		errno = EINVAL;
-		return (-1);
-	}
 	if ((flags & O_CREAT) != 0) {
 		va_start(ap, flags);
 		mode = va_arg(ap, int);
 		va_end(ap);
 	} else {
 		mode = 0;
-		if (__predict_false((flags & O_SYMLINK) == O_SYMLINK))
-			return (__openat_symlink(fd, path, flags, 0));
 	}
 	return (INTERPOS_SYS(openat, fd, path, flags, mode));
 }
diff --git a/lib/libthr/thread/thr_syscalls.c b/lib/libthr/thread/thr_syscalls.c
index 8168185188ea..bff2d0624aee 100644
--- a/lib/libthr/thread/thr_syscalls.c
+++ b/lib/libthr/thread/thr_syscalls.c
@@ -298,10 +298,7 @@ __thr_openat(int fd, const char *path, int flags, int mode)
 
 	curthread = _get_curthread();
 	_thr_cancel_enter(curthread);
-	if (__predict_false((flags & O_SYMLINK) == O_SYMLINK))
-		ret = __openat_symlink(fd, path, flags, 1);
-	else
-		ret = __sys_openat(fd, path, flags, mode);
+	ret = __sys_openat(fd, path, flags, mode);
 	_thr_cancel_leave(curthread, ret == -1);
 
 	return (ret);
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 675f6fb4e526..8f47a7abbc5e 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -727,8 +727,7 @@ bufspace_wait(struct bufdomain *bd, struct vnode *vp, int gbflags,
 	BD_LOCK(bd);
 	while (bd->bd_wanted) {
 		if (vp != NULL && vp->v_type != VCHR &&
-		    (td->td_pflags & TDP_BUFNEED) == 0 &&
-		    vp->v_bufobj.bo_dirty.bv_cnt > 0) {
+		    (td->td_pflags & TDP_BUFNEED) == 0) {
 			BD_UNLOCK(bd);
 			/*
 			 * getblk() is called with a vnode locked, and
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index 66210bf58a7c..3f8591bd0ba7 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -5737,7 +5737,7 @@ cache_fplookup_climb_mount(struct cache_fpl *fpl)
 
 	prev_mp = NULL;
 	for (;;) {
-		if (!vfs_op_thread_enter_crit(mp, &mpcpu)) {
+		if (!vfs_op_thread_enter_crit(mp, mpcpu)) {
 			if (prev_mp != NULL)
 				vfs_op_thread_exit_crit(prev_mp, prev_mpcpu);
 			return (cache_fpl_partial(fpl));
@@ -5792,7 +5792,7 @@ cache_fplookup_cross_mount(struct cache_fpl *fpl)
 		return (0);
 	}
 
-	if (!vfs_op_thread_enter_crit(mp, &mpcpu)) {
+	if (!vfs_op_thread_enter_crit(mp, mpcpu)) {
 		return (cache_fpl_partial(fpl));
 	}
 	if (!vn_seqc_consistent(vp, vp_seqc)) {
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index fff05a627162..ddc5a1b70887 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -500,7 +500,7 @@ vfs_ref_from_vp(struct vnode *vp)
 	if (__predict_false(mp == NULL)) {
 		return (mp);
 	}
-	if (vfs_op_thread_enter(mp, &mpcpu)) {
+	if (vfs_op_thread_enter(mp, mpcpu)) {
 		if (__predict_true(mp == vp->v_mount)) {
 			vfs_mp_count_add_pcpu(mpcpu, ref, 1);
 			vfs_op_thread_exit(mp, mpcpu);
@@ -527,7 +527,7 @@ vfs_ref(struct mount *mp)
 	struct mount_pcpu *mpcpu;
 
 	CTR2(KTR_VFS, "%s: mp %p", __func__, mp);
-	if (vfs_op_thread_enter(mp, &mpcpu)) {
+	if (vfs_op_thread_enter(mp, mpcpu)) {
 		vfs_mp_count_add_pcpu(mpcpu, ref, 1);
 		vfs_op_thread_exit(mp, mpcpu);
 		return;
@@ -645,7 +645,7 @@ vfs_rel(struct mount *mp)
 	struct mount_pcpu *mpcpu;
 
 	CTR2(KTR_VFS, "%s: mp %p", __func__, mp);
-	if (vfs_op_thread_enter(mp, &mpcpu)) {
+	if (vfs_op_thread_enter(mp, mpcpu)) {
 		vfs_mp_count_sub_pcpu(mpcpu, ref, 1);
 		vfs_op_thread_exit(mp, mpcpu);
 		return;
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 57de07ffaa12..58975f7ac932 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -879,7 +879,7 @@ vfs_busy(struct mount *mp, int flags)
 	MPASS((flags & ~MBF_MASK) == 0);
 	CTR3(KTR_VFS, "%s: mp %p with flags %d", __func__, mp, flags);
 
-	if (vfs_op_thread_enter(mp, &mpcpu)) {
+	if (vfs_op_thread_enter(mp, mpcpu)) {
 		MPASS((mp->mnt_kern_flag & MNTK_DRAINING) == 0);
 		MPASS((mp->mnt_kern_flag & MNTK_UNMOUNT) == 0);
 		MPASS((mp->mnt_kern_flag & MNTK_REFEXPIRE) == 0);
@@ -942,7 +942,7 @@ vfs_unbusy(struct mount *mp)
 
 	CTR2(KTR_VFS, "%s: mp %p", __func__, mp);
 
-	if (vfs_op_thread_enter(mp, &mpcpu)) {
+	if (vfs_op_thread_enter(mp, mpcpu)) {
 		MPASS((mp->mnt_kern_flag & MNTK_DRAINING) == 0);
 		vfs_mp_count_sub_pcpu(mpcpu, lockref, 1);
 		vfs_mp_count_sub_pcpu(mpcpu, ref, 1);
@@ -5817,15 +5817,6 @@ assert_vop_elocked(struct vnode *vp, const char *str)
 }
 #endif /* INVARIANTS */
 
-static bool
-vop_check_pollinfo(struct vnode *vp, int rc)
-{
-	return (rc == 0 &&
-	    (vn_irflag_read(vp) & (VIRF_KNOTE | VIRF_INOTIFY)) != 0);
-}
-#define	vop_check_pollinfo(vp, rc)	\
-    __predict_false((vop_check_pollinfo)((vp), (rc)))
-
 void
 vop_rename_fail(struct vop_rename_args *ap)
 {
@@ -6102,7 +6093,7 @@ vop_create_post(void *ap, int rc)
 	a = ap;
 	dvp = a->a_dvp;
 	vn_seqc_write_end(dvp);
-	if (rc == 0) {
+	if (!rc) {
 		VFS_KNOTE_LOCKED(dvp, NOTE_WRITE);
 		INOTIFY_NAME(*a->a_vpp, dvp, a->a_cnp, IN_CREATE);
 	}
@@ -6160,7 +6151,7 @@ vop_deleteextattr_post(void *ap, int rc)
 	a = ap;
 	vp = a->a_vp;
 	vn_seqc_write_end(vp);
-	if (vop_check_pollinfo(vp, rc)) {
+	if (!rc) {
 		VFS_KNOTE_LOCKED(a->a_vp, NOTE_ATTRIB);
 		INOTIFY(vp, IN_ATTRIB);
 	}
@@ -6190,7 +6181,7 @@ vop_link_post(void *ap, int rc)
 	tdvp = a->a_tdvp;
 	vn_seqc_write_end(vp);
 	vn_seqc_write_end(tdvp);
-	if (rc == 0) {
+	if (!rc) {
 		VFS_KNOTE_LOCKED(vp, NOTE_LINK);
 		VFS_KNOTE_LOCKED(tdvp, NOTE_WRITE);
 		INOTIFY_NAME(vp, tdvp, a->a_cnp, _IN_ATTRIB_LINKCOUNT);
@@ -6218,7 +6209,7 @@ vop_mkdir_post(void *ap, int rc)
 	a = ap;
 	dvp = a->a_dvp;
 	vn_seqc_write_end(dvp);
-	if (rc == 0) {
+	if (!rc) {
 		VFS_KNOTE_LOCKED(dvp, NOTE_WRITE | NOTE_LINK);
 		INOTIFY_NAME(*a->a_vpp, dvp, a->a_cnp, IN_CREATE);
 	}
@@ -6256,7 +6247,7 @@ vop_mknod_post(void *ap, int rc)
 	a = ap;
 	dvp = a->a_dvp;
 	vn_seqc_write_end(dvp);
-	if (rc == 0) {
+	if (!rc) {
 		VFS_KNOTE_LOCKED(dvp, NOTE_WRITE);
 		INOTIFY_NAME(*a->a_vpp, dvp, a->a_cnp, IN_CREATE);
 	}
@@ -6271,8 +6262,7 @@ vop_reclaim_post(void *ap, int rc)
 	a = ap;
 	vp = a->a_vp;
 	ASSERT_VOP_IN_SEQC(vp);
-
-	if (vop_check_pollinfo(vp, rc)) {
+	if (!rc) {
 		VFS_KNOTE_LOCKED(vp, NOTE_REVOKE);
 		INOTIFY_REVOKE(vp);
 	}
@@ -6303,7 +6293,7 @@ vop_remove_post(void *ap, int rc)
 	vp = a->a_vp;
 	vn_seqc_write_end(dvp);
 	vn_seqc_write_end(vp);
-	if (rc == 0) {
+	if (!rc) {
 		VFS_KNOTE_LOCKED(dvp, NOTE_WRITE);
 		VFS_KNOTE_LOCKED(vp, NOTE_DELETE);
 		INOTIFY_NAME(vp, dvp, a->a_cnp, _IN_ATTRIB_LINKCOUNT);
@@ -6376,7 +6366,7 @@ vop_rmdir_post(void *ap, int rc)
 	vp = a->a_vp;
 	vn_seqc_write_end(dvp);
 	vn_seqc_write_end(vp);
-	if (rc == 0) {
+	if (!rc) {
 		vp->v_vflag |= VV_UNLINKED;
 		VFS_KNOTE_LOCKED(dvp, NOTE_WRITE | NOTE_LINK);
 		VFS_KNOTE_LOCKED(vp, NOTE_DELETE);
@@ -6404,7 +6394,7 @@ vop_setattr_post(void *ap, int rc)
 	a = ap;
 	vp = a->a_vp;
 	vn_seqc_write_end(vp);
-	if (vop_check_pollinfo(vp, rc)) {
+	if (!rc) {
 		VFS_KNOTE_LOCKED(vp, NOTE_ATTRIB);
 		INOTIFY(vp, IN_ATTRIB);
 	}
@@ -6452,7 +6442,7 @@ vop_setextattr_post(void *ap, int rc)
 	a = ap;
 	vp = a->a_vp;
 	vn_seqc_write_end(vp);
-	if (vop_check_pollinfo(vp, rc)) {
+	if (!rc) {
 		VFS_KNOTE_LOCKED(vp, NOTE_ATTRIB);
 		INOTIFY(vp, IN_ATTRIB);
 	}
@@ -6478,7 +6468,7 @@ vop_symlink_post(void *ap, int rc)
 	a = ap;
 	dvp = a->a_dvp;
 	vn_seqc_write_end(dvp);
-	if (rc == 0) {
+	if (!rc) {
 		VFS_KNOTE_LOCKED(dvp, NOTE_WRITE);
 		INOTIFY_NAME(*a->a_vpp, dvp, a->a_cnp, IN_CREATE);
 	}
@@ -6489,7 +6479,7 @@ vop_open_post(void *ap, int rc)
 {
 	struct vop_open_args *a = ap;
 
-	if (vop_check_pollinfo(a->a_vp, rc)) {
+	if (!rc) {
 		VFS_KNOTE_LOCKED(a->a_vp, NOTE_OPEN);
 		INOTIFY(a->a_vp, IN_OPEN);
 	}
@@ -6500,9 +6490,8 @@ vop_close_post(void *ap, int rc)
 {
 	struct vop_close_args *a = ap;
 
-	if (rc == 0 && (a->a_cred != NOCRED || /* filter out revokes */
-	    !VN_IS_DOOMED(a->a_vp)) &&
-	    vop_check_pollinfo(a->a_vp, rc)) {
+	if (!rc && (a->a_cred != NOCRED || /* filter out revokes */
+	    !VN_IS_DOOMED(a->a_vp))) {
 		VFS_KNOTE_LOCKED(a->a_vp, (a->a_fflag & FWRITE) != 0 ?
 		    NOTE_CLOSE_WRITE : NOTE_CLOSE);
 		INOTIFY(a->a_vp, (a->a_fflag & FWRITE) != 0 ?
@@ -6515,7 +6504,7 @@ vop_read_post(void *ap, int rc)
 {
 	struct vop_read_args *a = ap;
 
-	if (vop_check_pollinfo(a->a_vp, rc)) {
+	if (!rc) {
 		VFS_KNOTE_LOCKED(a->a_vp, NOTE_READ);
 		INOTIFY(a->a_vp, IN_ACCESS);
 	}
@@ -6526,7 +6515,7 @@ vop_read_pgcache_post(void *ap, int rc)
 {
 	struct vop_read_pgcache_args *a = ap;
 
-	if (rc == 0)
+	if (!rc)
 		VFS_KNOTE_UNLOCKED(a->a_vp, NOTE_READ);
 }
 
@@ -6673,8 +6662,6 @@ vfs_knlunlock(void *arg)
 {
 	struct vnode *vp = arg;
 
-	if (KNLIST_EMPTY(&vp->v_pollinfo->vpi_selinfo.si_note))
-		vn_irflag_unset(vp, VIRF_KNOTE);
 	VOP_UNLOCK(vp);
 }
 
@@ -6722,11 +6709,7 @@ vfs_kqfilter(struct vop_kqfilter_args *ap)
 		return (ENOMEM);
 	knl = &vp->v_pollinfo->vpi_selinfo.si_note;
 	vhold(vp);
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
-	knlist_add(knl, kn, 1);
-	if ((vn_irflag_read(vp) & VIRF_KNOTE) == 0)
-		vn_irflag_set(vp, VIRF_KNOTE);
-	VOP_UNLOCK(vp);
+	knlist_add(knl, kn, 0);
 
 	return (0);
 }
@@ -7005,7 +6988,7 @@ vfs_cache_root(struct mount *mp, int flags, struct vnode **vpp)
 	struct vnode *vp;
 	int error;
 
-	if (!vfs_op_thread_enter(mp, &mpcpu))
+	if (!vfs_op_thread_enter(mp, mpcpu))
 		return (vfs_cache_root_fallback(mp, flags, vpp));
 	vp = atomic_load_ptr(&mp->mnt_rootvnode);
 	if (vp == NULL || VN_IS_DOOMED(vp)) {
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 15704634ff62..4061b2272193 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -2083,7 +2083,7 @@ vn_start_write_refed(struct mount *mp, int flags)
 	struct mount_pcpu *mpcpu;
 	int error, mflags;
 
-	if ((flags & V_XSLEEP) == 0 && vfs_op_thread_enter(mp, &mpcpu)) {
+	if ((flags & V_XSLEEP) == 0 && vfs_op_thread_enter(mp, mpcpu)) {
 		MPASS((mp->mnt_kern_flag & MNTK_SUSPEND) == 0);
 		vfs_mp_count_add_pcpu(mpcpu, writeopcount, 1);
 		vfs_op_thread_exit(mp, mpcpu);
@@ -2252,7 +2252,7 @@ vn_finished_write(struct mount *mp)
 	if (mp == NULL)
 		return;
 
-	if (vfs_op_thread_enter(mp, &mpcpu)) {
+	if (vfs_op_thread_enter(mp, mpcpu)) {
 		vfs_mp_count_sub_pcpu(mpcpu, writeopcount, 1);
 		vfs_mp_count_sub_pcpu(mpcpu, ref, 1);
 		vfs_op_thread_exit(mp, mpcpu);
diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h
index bf64d06f2a4d..0b13241f0ee3 100644
--- a/sys/sys/fcntl.h
+++ b/sys/sys/fcntl.h
@@ -142,13 +142,6 @@ typedef	__pid_t		pid_t;
 #define	O_EMPTY_PATH	0x02000000
 #define	O_NAMEDATTR	0x04000000	/* NFSv4 named attributes */
 #define	O_XATTR		O_NAMEDATTR	/* Solaris compatibility */
-
-/*
- * Emulate MacOSX compatibility flag without consuming a flags bit.
- * Selected bits set does not define a useful open request and is
- * unlikely to be specified by reasonable code.
- */
-#define	O_SYMLINK	(O_PATH | O_DSYNC | O_DIRECT)
 #endif
 
 #if __POSIX_VISIBLE >= 202405
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index c96ce7d7b080..18f85192f6c3 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -36,10 +36,8 @@
 #include <sys/ucred.h>
 #include <sys/queue.h>
 #ifdef _KERNEL
-#include <sys/systm.h>
 #include <sys/lock.h>
 #include <sys/lockmgr.h>
-#include <sys/proc.h>
 #include <sys/tslog.h>
 #include <sys/_mutex.h>
 #include <sys/_sx.h>
@@ -853,134 +851,114 @@ struct vfsops {
 
 vfs_statfs_t	__vfs_statfs;
 
-static inline int
-VFS_MOUNT(struct mount *mp)
-{
-	int rc;
-
-	TSRAW(curthread, TS_ENTER, "VFS_MOUNT", mp->mnt_vfc->vfc_name);
-	rc = mp->mnt_op->vfs_mount(mp);
-	TSRAW(curthread, TS_EXIT, "VFS_MOUNT", mp->mnt_vfc->vfc_name);
-	return (rc);
-}
-
-static inline int
-VFS_UNMOUNT(struct mount *mp, int force)
-{
-	return (mp->mnt_op->vfs_unmount(mp, force));
-}
-
-static inline int
-VFS_ROOT(struct mount *mp, int flags, struct vnode **vpp)
-{
-	return (mp->mnt_op->vfs_root(mp, flags, vpp));
-}
-
-static inline int
-VFS_CACHEDROOT(struct mount *mp, int flags, struct vnode **vpp)
-{
-	return (mp->mnt_op->vfs_cachedroot(mp, flags, vpp));
-}
-
-static inline int
-VFS_QUOTACTL(struct mount *mp, int cmds, uid_t uid, void *arg, bool *mp_busy)
-{
-	return (mp->mnt_op->vfs_quotactl(mp, cmds, uid, arg, mp_busy));
-}
-
-static inline int
-VFS_STATFS(struct mount *mp, struct statfs *sbp)
-{
-	return (__vfs_statfs(mp, sbp));
-}
-
-static inline int
-VFS_SYNC(struct mount *mp, int waitfor)
-{
-	return (mp->mnt_op->vfs_sync(mp, waitfor));
-}
-
-static inline int
-VFS_VGET(struct mount *mp, ino_t ino, int flags, struct vnode **vpp)
-{
-	return (mp->mnt_op->vfs_vget(mp, ino, flags, vpp));
-}
-
-static inline int
-VFS_FHTOVP(struct mount *mp, struct fid *fidp, int flags, struct vnode **vpp)
-{
-	return (mp->mnt_op->vfs_fhtovp(mp, fidp, flags, vpp));
-}
-
-static inline int
-VFS_CHECKEXP(struct mount *mp, struct sockaddr *nam, uint64_t *extflagsp,
-    struct ucred **credanonp, int *numsecflavors, int *secflavors)
-{
-	return (mp->mnt_op->vfs_checkexp(mp, nam, extflagsp, credanonp,
-	    numsecflavors, secflavors));
-}
-
-static inline int
-VFS_EXTATTRCTL(struct mount *mp, int cmd, struct vnode *filename_vp,
-    int attrnamespace, const char *attrname)
-{
-	return (mp->mnt_op->vfs_extattrctl(mp, cmd, filename_vp,
-	    attrnamespace, attrname));
-}
-
-static inline int
-VFS_SYSCTL(struct mount *mp, fsctlop_t op, struct sysctl_req *req)
-{
-	return (mp->mnt_op->vfs_sysctl(mp, op, req));
-}
-
-static inline void
-VFS_SUSP_CLEAN(struct mount *mp)
-{
-	if (mp->mnt_op->vfs_susp_clean != NULL)
-		mp->mnt_op->vfs_susp_clean(mp);
-}
-
-static inline void
-VFS_RECLAIM_LOWERVP(struct mount *mp, struct vnode *vp)
-{
-	if (mp->mnt_op->vfs_reclaim_lowervp != NULL)
-		mp->mnt_op->vfs_reclaim_lowervp(mp, vp);
-}
+#define	VFS_MOUNT(MP) ({						\
+	int _rc;							\
+									\
+	TSRAW(curthread, TS_ENTER, "VFS_MOUNT", (MP)->mnt_vfc->vfc_name);\
+	_rc = (*(MP)->mnt_op->vfs_mount)(MP);				\
+	TSRAW(curthread, TS_EXIT, "VFS_MOUNT", (MP)->mnt_vfc->vfc_name);\
+	_rc; })
+
+#define	VFS_UNMOUNT(MP, FORCE) ({					\
+	int _rc;							\
+									\
+	_rc = (*(MP)->mnt_op->vfs_unmount)(MP, FORCE);			\
+	_rc; })
+
+#define	VFS_ROOT(MP, FLAGS, VPP) ({					\
+	int _rc;							\
+									\
+	_rc = (*(MP)->mnt_op->vfs_root)(MP, FLAGS, VPP);		\
+	_rc; })
+
+#define	VFS_CACHEDROOT(MP, FLAGS, VPP) ({				\
+	int _rc;							\
+									\
+	_rc = (*(MP)->mnt_op->vfs_cachedroot)(MP, FLAGS, VPP);		\
+	_rc; })
+
+#define	VFS_QUOTACTL(MP, C, U, A, MP_BUSY) ({				\
+	int _rc;							\
+									\
+	_rc = (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, MP_BUSY);	\
+	_rc; })
+
+#define	VFS_STATFS(MP, SBP) ({						\
+	int _rc;							\
+									\
+	_rc = __vfs_statfs((MP), (SBP));				\
+	_rc; })
+
+#define	VFS_SYNC(MP, WAIT) ({						\
+	int _rc;							\
+									\
+	_rc = (*(MP)->mnt_op->vfs_sync)(MP, WAIT);			\
+	_rc; })
+
+#define	VFS_VGET(MP, INO, FLAGS, VPP) ({				\
+	int _rc;							\
+									\
+	_rc = (*(MP)->mnt_op->vfs_vget)(MP, INO, FLAGS, VPP);		\
+	_rc; })
+
+#define	VFS_FHTOVP(MP, FIDP, FLAGS, VPP) ({				\
+	int _rc;							\
+									\
+	_rc = (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, FLAGS, VPP);	\
+	_rc; })
+
+#define	VFS_CHECKEXP(MP, NAM, EXFLG, CRED, NUMSEC, SEC) ({		\
+	int _rc;							\
+									\
+	_rc = (*(MP)->mnt_op->vfs_checkexp)(MP, NAM, EXFLG, CRED, NUMSEC,\
+	    SEC);							\
+	_rc; })
+
+#define	VFS_EXTATTRCTL(MP, C, FN, NS, N) ({				\
+	int _rc;							\
+									\
+	_rc = (*(MP)->mnt_op->vfs_extattrctl)(MP, C, FN, NS, N);	\
+	_rc; })
+
+#define	VFS_SYSCTL(MP, OP, REQ) ({					\
+	int _rc;							\
+									\
+	_rc = (*(MP)->mnt_op->vfs_sysctl)(MP, OP, REQ);			\
+	_rc; })
+
+#define	VFS_SUSP_CLEAN(MP) do {						\
+	if (*(MP)->mnt_op->vfs_susp_clean != NULL) {			\
+		(*(MP)->mnt_op->vfs_susp_clean)(MP);			\
+	}								\
+} while (0)
 
-static inline void
-VFS_UNLINK_LOWERVP(struct mount *mp, struct vnode *vp)
-{
-	if (mp->mnt_op->vfs_unlink_lowervp != NULL)
-		mp->mnt_op->vfs_unlink_lowervp(mp, vp);
-}
+#define	VFS_RECLAIM_LOWERVP(MP, VP) do {				\
+	if (*(MP)->mnt_op->vfs_reclaim_lowervp != NULL) {		\
+		(*(MP)->mnt_op->vfs_reclaim_lowervp)((MP), (VP));	\
+	}								\
+} while (0)
 
-static inline void
-VFS_PURGE(struct mount *mp)
-{
-	if (mp->mnt_op->vfs_purge != NULL)
-		mp->mnt_op->vfs_purge(mp);
-}
+#define	VFS_UNLINK_LOWERVP(MP, VP) do {					\
+	if (*(MP)->mnt_op->vfs_unlink_lowervp != NULL) {		\
+		(*(MP)->mnt_op->vfs_unlink_lowervp)((MP), (VP));	\
+	}								\
+} while (0)
 
-#include <sys/vnode.h>
+#define	VFS_PURGE(MP) do {						\
+	if (*(MP)->mnt_op->vfs_purge != NULL) {				\
+		(*(MP)->mnt_op->vfs_purge)(MP);				\
+	}								\
+} while (0)
 
-static inline void
-VFS_KNOTE_LOCKED(struct vnode *vp, int hint)
-{
-	if ((vn_irflag_read(vp) & VIRF_KNOTE) != 0) {
-		KNOTE_LOCKED(&vp->v_pollinfo->vpi_selinfo.si_note,
-		    hint);
-	}
-}
+#define VFS_KNOTE_LOCKED(vp, hint) do					\
+{									\
+	VN_KNOTE((vp), (hint), KNF_LISTLOCKED);				\
+} while (0)
 
-static inline void
-VFS_KNOTE_UNLOCKED(struct vnode *vp, int hint)
-{
-	if ((vn_irflag_read(vp) & VIRF_KNOTE) != 0) {
-		KNOTE_UNLOCKED(&vp->v_pollinfo->vpi_selinfo.si_note,
-		    hint);
-	}
-}
+#define VFS_KNOTE_UNLOCKED(vp, hint) do					\
+{									\
+	VN_KNOTE((vp), (hint), 0);					\
+} while (0)
 
 #include <sys/module.h>
 
@@ -1160,64 +1138,47 @@ void resume_all_fs(void);
  */
 #define	vfs_mount_pcpu(mp)		zpcpu_get(mp->mnt_pcpu)
 #define	vfs_mount_pcpu_remote(mp, cpu)	zpcpu_get_cpu(mp->mnt_pcpu, cpu)
-static void vfs_op_thread_exit_crit(struct mount *mp, struct mount_pcpu *mpcpu);
-
-static inline bool
-vfs_op_thread_entered(struct mount *mp)
-{
-	struct mount_pcpu *mpcpu = vfs_mount_pcpu(mp);
-
-	MPASS(curthread->td_critnest > 0);
-	return (mpcpu->mntp_thread_in_ops == 1);
-}
-
-static inline bool
-vfs_op_thread_enter_crit(struct mount *mp, struct mount_pcpu **mpcpup)
-{
-	struct mount_pcpu *mpcpu;
-	bool retval_crit = true;
-
-	MPASS(curthread->td_critnest > 0);
-	mpcpu = vfs_mount_pcpu(mp);
-	MPASS(mpcpu->mntp_thread_in_ops == 0);
-	mpcpu->mntp_thread_in_ops = 1;
-	atomic_interrupt_fence();
-	if (__predict_false(mp->mnt_vfs_ops > 0)) {
-		vfs_op_thread_exit_crit(mp, mpcpu);
-		retval_crit = false;
-	}
-	*mpcpup = mpcpu;
-	return (retval_crit);
-}
-
-static inline bool
-vfs_op_thread_enter(struct mount *mp, struct mount_pcpu **mpcpup)
-{
-	bool retval;
 
-	critical_enter();
-	retval = vfs_op_thread_enter_crit(mp, mpcpup);
-	if (__predict_false(!retval))
-		critical_exit();
-	return (retval);
-}
-
-static inline void
-vfs_op_thread_exit_crit(struct mount *mp, struct mount_pcpu *mpcpu)
-{
-	MPASS(mpcpu == vfs_mount_pcpu(mp));
-	MPASS(mpcpu->mntp_thread_in_ops == 1);
-
-	atomic_interrupt_fence();
-	mpcpu->mntp_thread_in_ops = 0;
-}
+#define vfs_op_thread_entered(mp) ({				\
+	MPASS(curthread->td_critnest > 0);			\
+	struct mount_pcpu *_mpcpu = vfs_mount_pcpu(mp);		\
+	_mpcpu->mntp_thread_in_ops == 1;			\
+})
+
+#define vfs_op_thread_enter_crit(mp, _mpcpu) ({			\
+	bool _retval_crit = true;				\
+	MPASS(curthread->td_critnest > 0);			\
+	_mpcpu = vfs_mount_pcpu(mp);				\
+	MPASS(mpcpu->mntp_thread_in_ops == 0);			\
+	_mpcpu->mntp_thread_in_ops = 1;				\
+	atomic_interrupt_fence();					\
+	if (__predict_false(mp->mnt_vfs_ops > 0)) {		\
+		vfs_op_thread_exit_crit(mp, _mpcpu);		\
+		_retval_crit = false;				\
+	}							\
+	_retval_crit;						\
+})
+
+#define vfs_op_thread_enter(mp, _mpcpu) ({			\
+	bool _retval;						\
+	critical_enter();					\
+	_retval = vfs_op_thread_enter_crit(mp, _mpcpu);		\
+	if (__predict_false(!_retval))				\
+		critical_exit();				\
+	_retval;						\
+})
+
+#define vfs_op_thread_exit_crit(mp, _mpcpu) do {		\
+	MPASS(_mpcpu == vfs_mount_pcpu(mp));			\
+	MPASS(_mpcpu->mntp_thread_in_ops == 1);			\
+	atomic_interrupt_fence();					\
+	_mpcpu->mntp_thread_in_ops = 0;				\
+} while (0)
 
-static inline void
-vfs_op_thread_exit(struct mount *mp, struct mount_pcpu *mpcpu)
-{
-	vfs_op_thread_exit_crit(mp, mpcpu);
-	critical_exit();
-}
+#define vfs_op_thread_exit(mp, _mpcpu) do {			\
+	vfs_op_thread_exit_crit(mp, _mpcpu);			\
+	critical_exit();					\
+} while (0)
 
 #define vfs_mp_count_add_pcpu(_mpcpu, count, val) do {		\
 	MPASS(_mpcpu->mntp_thread_in_ops == 1);			\
diff --git a/sys/sys/rangelock.h b/sys/sys/rangelock.h
index 00fe7eee851e..32ccf3427b49 100644
--- a/sys/sys/rangelock.h
+++ b/sys/sys/rangelock.h
@@ -46,16 +46,10 @@ struct rl_q_entry;
  * all existing lock owners are compatible with the request. Two lock
  * owners are compatible if their ranges do not overlap, or both
  * owners are for read.
- *
- * The resvX fields can be used by consumers.  For instance, struct
- * vnode uses resv1 as v_vrflag.
  */
 struct rangelock {
 	uintptr_t head;
 	bool sleepers;
-	uint8_t resv0;
-	uint16_t resv1;
-	uint32_t resv2;
 };
 
 #ifdef _KERNEL
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index 70340faca1b4..3fd2c770cda1 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -203,7 +203,6 @@ struct vnode {
 						   (negative) text users */
 	int	v_seqc_users;			/* i modifications pending */
 };
-#define	v_vrflag	v_rl.resv1
 
 #define VN_ISDEV(vp)		VTYPE_ISDEV((vp)->v_type)
 
@@ -222,17 +221,21 @@ _Static_assert(sizeof(struct vnode) <= 448, "vnode size crosses 448 bytes");
 
 #define	bo2vnode(bo)	__containerof((bo), struct vnode, v_bufobj)
 
+/* XXX: These are temporary to avoid a source sweep at this time */
 #define v_object	v_bufobj.bo_object
 
-#define VN_KNOTE(vp, b, a)              				\
-do {                    						\
-	if ((vn_irflag_read(vp) & VIRF_KNOTE) != 0) {			\
-		KNOTE(&vp->v_pollinfo->vpi_selinfo.si_note, (b),	\
-		    (a) | KNF_NOKQLOCK);				\
-	}								\
-} while (0)
-#define   VN_KNOTE_LOCKED(vp, b)     VN_KNOTE(vp, b, KNF_LISTLOCKED)
-#define   VN_KNOTE_UNLOCKED(vp, b)   VN_KNOTE(vp, b, 0)
+/* We don't need to lock the knlist */
+#define	VN_KNLIST_EMPTY(vp) ((vp)->v_pollinfo == NULL ||	\
+	    KNLIST_EMPTY(&(vp)->v_pollinfo->vpi_selinfo.si_note))
*** 38 LINES SKIPPED ***


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f7ac30.42c23.2250bb73>