The branch stable/15 has been updated by kib:

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

commit 5a0a2d269f37fa79ee879e54856c94272b7e3c33
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2025-10-08 15:42:27 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2025-10-16 02:22:20 +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 0a93878c859f..abd652c4ac1c 100644
--- a/sys/fs/nullfs/null.h
+++ b/sys/fs/nullfs/null.h
@@ -78,6 +78,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 4cddf24a5745..e2dabd8e33cc 100644
--- a/sys/fs/nullfs/null_vfsops.c
+++ b/sys/fs/nullfs/null_vfsops.c
@@ -116,7 +116,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;
@@ -150,7 +150,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 74c1a8f3acb6..ebb765b0a1c5 100644
--- a/sys/fs/nullfs/null_vnops.c
+++ b/sys/fs/nullfs/null_vnops.c
@@ -274,7 +274,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;

Reply via email to