Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/ad-namecache]: src/sys/miscfs/genfs Make sure LK_UPGRADE always comes wi...
details: https://anonhg.NetBSD.org/src/rev/f2a871d8f690
branches: ad-namecache
changeset: 850538:f2a871d8f690
user: ad <ad%NetBSD.org@localhost>
date: Wed Jan 22 12:00:18 2020 +0000
description:
Make sure LK_UPGRADE always comes with LK_NOWAIT; dropping the lock in here
is unclean and I wonder if it could screw over fstrans.
diffstat:
sys/miscfs/genfs/genfs_vnops.c | 16 ++++++----------
1 files changed, 6 insertions(+), 10 deletions(-)
diffs (46 lines):
diff -r 242fa3a258cc -r f2a871d8f690 sys/miscfs/genfs/genfs_vnops.c
--- a/sys/miscfs/genfs/genfs_vnops.c Wed Jan 22 11:40:16 2020 +0000
+++ b/sys/miscfs/genfs/genfs_vnops.c Wed Jan 22 12:00:18 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfs_vnops.c,v 1.200.2.1 2020/01/18 17:12:59 ad Exp $ */
+/* $NetBSD: genfs_vnops.c,v 1.200.2.2 2020/01/22 12:00:18 ad 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.200.2.1 2020/01/18 17:12:59 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.200.2.2 2020/01/22 12:00:18 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -295,11 +295,9 @@
if (ISSET(flags, LK_DOWNGRADE)) {
rw_downgrade(vip->vi_lock);
} else if (ISSET(flags, LK_UPGRADE)) {
+ KASSERT(ISSET(flags, LK_NOWAIT));
if (!rw_tryupgrade(vip->vi_lock)) {
- if (ISSET(flags, LK_NOWAIT))
- return EBUSY;
- rw_exit(vip->vi_lock);
- rw_enter(vip->vi_lock, RW_WRITER);
+ return EBUSY;
}
} else if ((flags & (LK_EXCLUSIVE | LK_SHARED)) != 0) {
op = (ISSET(flags, LK_EXCLUSIVE) ? RW_WRITER : RW_READER);
@@ -349,11 +347,9 @@
if (ISSET(flags, LK_DOWNGRADE)) {
rw_downgrade(vip->vi_lock);
} else if (ISSET(flags, LK_UPGRADE)) {
+ KASSERT(ISSET(flags, LK_NOWAIT));
if (!rw_tryupgrade(vip->vi_lock)) {
- if (ISSET(flags, LK_NOWAIT))
- return EBUSY;
- rw_exit(vip->vi_lock);
- rw_enter(vip->vi_lock, RW_WRITER);
+ return EBUSY;
}
} else if ((flags & (LK_EXCLUSIVE | LK_SHARED)) != 0) {
op = (ISSET(flags, LK_EXCLUSIVE) ? RW_WRITER : RW_READER);
Home |
Main Index |
Thread Index |
Old Index