Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Dec 2023 00:43:58 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 6bed0f65fb68 - stable/14 - VFS: add VOP_GETLOWVNODE()
Message-ID:  <202312050043.3B50hwN6029827@gitrepo.freebsd.org>

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

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

commit 6bed0f65fb68f0f96bfbf5dcdbab26babdafc655
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-11-18 08:55:48 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-12-05 00:43:27 +0000

    VFS: add VOP_GETLOWVNODE()
    
    (cherry picked from commit 4cbe4c48a7e574ec1bb919351d7a57d252b00b62)
---
 sys/fs/nullfs/null_vnops.c | 18 ++++++++++++++++++
 sys/kern/vfs_default.c     | 10 ++++++++++
 sys/kern/vnode_if.src      |  7 +++++++
 3 files changed, 35 insertions(+)

diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c
index 9898bf010a21..7db7a352f176 100644
--- a/sys/fs/nullfs/null_vnops.c
+++ b/sys/fs/nullfs/null_vnops.c
@@ -1131,6 +1131,23 @@ null_vput_pair(struct vop_vput_pair_args *ap)
 	return (res);
 }
 
+static int
+null_getlowvnode(struct vop_getlowvnode_args *ap)
+{
+	struct vnode *vp, *vpl;
+
+	vp = ap->a_vp;
+	if (vn_lock(vp, LK_SHARED) != 0)
+		return (EBADF);
+
+	vpl = NULLVPTOLOWERVP(vp);
+	vhold(vpl);
+	VOP_UNLOCK(vp);
+	VOP_GETLOWVNODE(vpl, ap->a_vplp, ap->a_flags);
+	vdrop(vpl);
+	return (0);
+}
+
 /*
  * Global vfs data structures
  */
@@ -1143,6 +1160,7 @@ struct vop_vector null_vnodeops = {
 	.vop_bmap =		VOP_EOPNOTSUPP,
 	.vop_stat =		null_stat,
 	.vop_getattr =		null_getattr,
+	.vop_getlowvnode =	null_getlowvnode,
 	.vop_getwritemount =	null_getwritemount,
 	.vop_inactive =		null_inactive,
 	.vop_need_inactive =	null_need_inactive,
diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c
index c28478f0973d..82076c84279d 100644
--- a/sys/kern/vfs_default.c
+++ b/sys/kern/vfs_default.c
@@ -85,6 +85,7 @@ static int vop_stdgetpages_async(struct vop_getpages_async_args *ap);
 static int vop_stdread_pgcache(struct vop_read_pgcache_args *ap);
 static int vop_stdstat(struct vop_stat_args *ap);
 static int vop_stdvput_pair(struct vop_vput_pair_args *ap);
+static int vop_stdgetlowvnode(struct vop_getlowvnode_args *ap);
 
 /*
  * This vnode table stores what we want to do if the filesystem doesn't
@@ -115,6 +116,7 @@ struct vop_vector default_vnodeops = {
 	.vop_fsync =		VOP_NULL,
 	.vop_stat =		vop_stdstat,
 	.vop_fdatasync =	vop_stdfdatasync,
+	.vop_getlowvnode = 	vop_stdgetlowvnode,
 	.vop_getpages =		vop_stdgetpages,
 	.vop_getpages_async =	vop_stdgetpages_async,
 	.vop_getwritemount = 	vop_stdgetwritemount,
@@ -1610,3 +1612,11 @@ vop_stdvput_pair(struct vop_vput_pair_args *ap)
 		vput(vp);
 	return (0);
 }
+
+static int
+vop_stdgetlowvnode(struct vop_getlowvnode_args *ap)
+{
+	vref(ap->a_vp);
+	*ap->a_vplp = ap->a_vp;
+	return (0);
+}
diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src
index 3b16d4c0ada8..d13e7efb4bb5 100644
--- a/sys/kern/vnode_if.src
+++ b/sys/kern/vnode_if.src
@@ -471,6 +471,13 @@ vop_getwritemount {
 	OUT struct mount **mpp;
 };
 
+%% getwritevnode vp	= = =
+
+vop_getlowvnode {
+	IN struct vnode *vp;
+	OUT struct vnode **vplp;
+	IN int flags;
+};
 
 %% print	vp	- - -
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202312050043.3B50hwN6029827>