Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/nfs Must hold kn->kn_kq->kq_lock to modify kn->kn_flags.
details: https://anonhg.NetBSD.org/src/rev/f66199130353
branches: trunk
changeset: 989053:f66199130353
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sun Oct 10 23:46:22 2021 +0000
description:
Must hold kn->kn_kq->kq_lock to modify kn->kn_flags.
diffstat:
sys/miscfs/genfs/genfs_vnops.c | 11 +++++++++--
sys/nfs/nfs_kq.c | 9 +++++++--
2 files changed, 16 insertions(+), 4 deletions(-)
diffs (102 lines):
diff -r 0d6010307c08 -r f66199130353 sys/miscfs/genfs/genfs_vnops.c
--- a/sys/miscfs/genfs/genfs_vnops.c Sun Oct 10 23:39:50 2021 +0000
+++ b/sys/miscfs/genfs/genfs_vnops.c Sun Oct 10 23:46:22 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfs_vnops.c,v 1.212 2021/09/26 01:16:10 thorpej Exp $ */
+/* $NetBSD: genfs_vnops.c,v 1.213 2021/10/10 23:46:23 thorpej Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.212 2021/09/26 01:16:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.213 2021/10/10 23:46:23 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -68,6 +68,7 @@
#include <sys/namei.h>
#include <sys/vnode_impl.h>
#include <sys/fcntl.h>
+#include <sys/eventvar.h> /* XXX for kq->kq_lock */
#include <sys/kmem.h>
#include <sys/poll.h>
#include <sys/mman.h>
@@ -525,7 +526,9 @@
switch (hint) {
case NOTE_REVOKE:
KASSERT(mutex_owned(vp->v_interlock));
+ mutex_spin_enter(&kn->kn_kq->kq_lock);
kn->kn_flags |= (EV_EOF | EV_ONESHOT);
+ mutex_spin_exit(&kn->kn_kq->kq_lock);
return (1);
case 0:
mutex_enter(vp->v_interlock);
@@ -552,7 +555,9 @@
switch (hint) {
case NOTE_REVOKE:
KASSERT(mutex_owned(vp->v_interlock));
+ mutex_spin_enter(&kn->kn_kq->kq_lock);
kn->kn_flags |= (EV_EOF | EV_ONESHOT);
+ mutex_spin_exit(&kn->kn_kq->kq_lock);
return (1);
case 0:
mutex_enter(vp->v_interlock);
@@ -575,7 +580,9 @@
switch (hint) {
case NOTE_REVOKE:
KASSERT(mutex_owned(vp->v_interlock));
+ mutex_spin_enter(&kn->kn_kq->kq_lock);
kn->kn_flags |= EV_EOF;
+ mutex_spin_exit(&kn->kn_kq->kq_lock);
if ((kn->kn_sfflags & hint) != 0)
kn->kn_fflags |= hint;
return (1);
diff -r 0d6010307c08 -r f66199130353 sys/nfs/nfs_kq.c
--- a/sys/nfs/nfs_kq.c Sun Oct 10 23:39:50 2021 +0000
+++ b/sys/nfs/nfs_kq.c Sun Oct 10 23:46:22 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_kq.c,v 1.28 2021/09/26 01:16:10 thorpej Exp $ */
+/* $NetBSD: nfs_kq.c,v 1.29 2021/10/10 23:46:22 thorpej Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_kq.c,v 1.28 2021/09/26 01:16:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_kq.c,v 1.29 2021/10/10 23:46:22 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -43,6 +43,7 @@
#include <sys/vnode.h>
#include <sys/unistd.h>
#include <sys/file.h>
+#include <sys/eventvar.h> /* XXX for kq->kq_lock */
#include <sys/kthread.h>
#include <nfs/rpcv2.h>
@@ -231,7 +232,9 @@
switch (hint) {
case NOTE_REVOKE:
KASSERT(mutex_owned(vp->v_interlock));
+ mutex_spin_enter(&kn->kn_kq->kq_lock);
kn->kn_flags |= (EV_EOF | EV_ONESHOT);
+ mutex_spin_exit(&kn->kn_kq->kq_lock);
return (1);
case 0:
mutex_enter(vp->v_interlock);
@@ -255,7 +258,9 @@
switch (hint) {
case NOTE_REVOKE:
KASSERT(mutex_owned(vp->v_interlock));
+ mutex_spin_enter(&kn->kn_kq->kq_lock);
kn->kn_flags |= EV_EOF;
+ mutex_spin_exit(&kn->kn_kq->kq_lock);
if ((kn->kn_sfflags & hint) != 0)
kn->kn_fflags |= hint;
return (1);
Home |
Main Index |
Thread Index |
Old Index