This makes it possible to attach pipe, socket and kqueue event filters
without acquiring the kernel lock. Event filters behind vn_kqfilter()
are not MP-safe yet, so vn_kqfilter() has to take KERNEL_LOCK().
dmabuf_kqfilter() can skip locking because it has no side effects.
OK anton@, mpi@
-/* $OpenBSD: kern_event.c,v 1.171 2021/11/12 04:34:22 visa Exp $ */
+/* $OpenBSD: kern_event.c,v 1.172 2021/11/13 06:04:02 visa Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
};
const struct filterops file_filtops = {
- .f_flags = FILTEROP_ISFD,
+ .f_flags = FILTEROP_ISFD | FILTEROP_MPSAFE,
.f_attach = filt_fileattach,
.f_detach = NULL,
.f_event = NULL,
-/* $OpenBSD: vfs_vnops.c,v 1.118 2021/10/25 10:24:54 claudio Exp $ */
+/* $OpenBSD: vfs_vnops.c,v 1.119 2021/11/13 06:04:02 visa Exp $ */
/* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */
/*
int
vn_kqfilter(struct file *fp, struct knote *kn)
{
- return (VOP_KQFILTER(fp->f_data, fp->f_flag, kn));
+ int error;
+
+ KERNEL_LOCK();
+ error = VOP_KQFILTER(fp->f_data, fp->f_flag, kn);
+ KERNEL_UNLOCK();
+ return (error);
}
int