git: b7b6d45008fd - stable/15 - kqueue: handle copy for vnode filters

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sat, 01 Nov 2025 00:45:09 UTC
The branch stable/15 has been updated by kib:

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

commit b7b6d45008fdee87477f041a9f220150523f3a7b
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-08-23 12:06:42 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-11-01 00:43:14 +0000

    kqueue: handle copy for vnode filters
    
    (cherry picked from commit 6b71c4ff698e1ba2266a85ff2ad89f2c2a8a16de)
---
 sys/kern/vfs_subr.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 57732ddab7d9..24210b63aaf5 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -6609,24 +6609,28 @@ static int	filt_vfsvnode(struct knote *kn, long hint);
 static void	filt_vfsdetach(struct knote *kn);
 static int	filt_vfsdump(struct proc *p, struct knote *kn,
 		    struct kinfo_knote *kin);
+static int	filt_vfscopy(struct knote *kn, struct proc *p1);
 
 static const struct filterops vfsread_filtops = {
 	.f_isfd = 1,
 	.f_detach = filt_vfsdetach,
 	.f_event = filt_vfsread,
 	.f_userdump = filt_vfsdump,
+	.f_copy = filt_vfscopy,
 };
 static const struct filterops vfswrite_filtops = {
 	.f_isfd = 1,
 	.f_detach = filt_vfsdetach,
 	.f_event = filt_vfswrite,
 	.f_userdump = filt_vfsdump,
+	.f_copy = filt_vfscopy,
 };
 static const struct filterops vfsvnode_filtops = {
 	.f_isfd = 1,
 	.f_detach = filt_vfsdetach,
 	.f_event = filt_vfsvnode,
 	.f_userdump = filt_vfsdump,
+	.f_copy = filt_vfscopy,
 };
 
 static void
@@ -6810,6 +6814,16 @@ filt_vfsdump(struct proc *p, struct knote *kn, struct kinfo_knote *kin)
 	return (0);
 }
 
+static int
+filt_vfscopy(struct knote *kn, struct proc *p1)
+{
+	struct vnode *vp;
+
+	vp = (struct vnode *)kn->kn_hook;
+	vhold(vp);
+	return (0);
+}
+
 int
 vfs_read_dirent(struct vop_readdir_args *ap, struct dirent *dp, off_t off)
 {