git: 26285c35d1f2 - stable/14 - nullfs: add a helper for testing if vnode belongs to a nullfs mount
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 24 Oct 2025 09:51:51 UTC
The branch stable/14 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=26285c35d1f25f9fbbcac93720eadc0cb45eda78
commit 26285c35d1f25f9fbbcac93720eadc0cb45eda78
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-10-08 15:42:27 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-10-24 09:47:36 +0000
nullfs: add a helper for testing if vnode belongs to a nullfs mount
(cherry picked from commit 419f2fe6b70b1a409bf7eca7020d7c745558690f)
---
sys/fs/nullfs/null.h | 10 ++++++++++
sys/fs/nullfs/null_vfsops.c | 4 ++--
sys/fs/nullfs/null_vnops.c | 2 +-
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/sys/fs/nullfs/null.h b/sys/fs/nullfs/null.h
index 3ae0cd02b2b6..34b8b4225ba8 100644
--- a/sys/fs/nullfs/null.h
+++ b/sys/fs/nullfs/null.h
@@ -80,6 +80,16 @@ struct vnode *null_checkvp(struct vnode *vp, char *fil, int lno);
#endif
extern struct vop_vector null_vnodeops;
+extern struct vop_vector null_vnodeops_no_unp_bypass;
+
+static inline bool
+null_is_nullfs_vnode(struct vnode *vp)
+{
+ const struct vop_vector *op;
+
+ op = vp->v_op;
+ return (op == &null_vnodeops);
+}
#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_NULLFSNODE);
diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c
index 8d980932623d..14a6ed5d4d4c 100644
--- a/sys/fs/nullfs/null_vfsops.c
+++ b/sys/fs/nullfs/null_vfsops.c
@@ -120,7 +120,7 @@ nullfs_mount(struct mount *mp)
/*
* Unlock lower node to avoid possible deadlock.
*/
- if (mp->mnt_vnodecovered->v_op == &null_vnodeops &&
+ if (null_is_nullfs_vnode(mp->mnt_vnodecovered) &&
VOP_ISLOCKED(mp->mnt_vnodecovered) == LK_EXCLUSIVE) {
VOP_UNLOCK(mp->mnt_vnodecovered);
isvnunlocked = true;
@@ -154,7 +154,7 @@ nullfs_mount(struct mount *mp)
/*
* Check multi null mount to avoid `lock against myself' panic.
*/
- if (mp->mnt_vnodecovered->v_op == &null_vnodeops) {
+ if (null_is_nullfs_vnode(mp->mnt_vnodecovered)) {
nn = VTONULL(mp->mnt_vnodecovered);
if (nn == NULL || lowerrootvp == nn->null_lowervp) {
NULLFSDEBUG("nullfs_mount: multi null mount?\n");
diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c
index 41915da7f13c..e398053c7028 100644
--- a/sys/fs/nullfs/null_vnops.c
+++ b/sys/fs/nullfs/null_vnops.c
@@ -258,7 +258,7 @@ null_bypass(struct vop_generic_args *ap)
* that aren't. (We must always map first vp or vclean fails.)
*/
if (i != 0 && (*this_vp_p == NULLVP ||
- (*this_vp_p)->v_op != &null_vnodeops)) {
+ !null_is_nullfs_vnode(*this_vp_p))) {
old_vps[i] = NULLVP;
} else {
old_vps[i] = *this_vp_p;