Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/ad-namecache]: src/sys Allow VOP_LOCK(LK_NONE).



details:   https://anonhg.NetBSD.org/src/rev/6d1c9650cc4a
branches:  ad-namecache
changeset: 467260:6d1c9650cc4a
user:      ad <ad%NetBSD.org@localhost>
date:      Sat Jan 18 17:12:59 2020 +0000

description:
Allow VOP_LOCK(LK_NONE).

diffstat:

 sys/kern/vnode_if.sh           |  4 ++--
 sys/miscfs/genfs/genfs_vnops.c |  8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diffs (57 lines):

diff -r 97f91f24bb4e -r 6d1c9650cc4a sys/kern/vnode_if.sh
--- a/sys/kern/vnode_if.sh      Sat Jan 18 15:42:02 2020 +0000
+++ b/sys/kern/vnode_if.sh      Sat Jan 18 17:12:59 2020 +0000
@@ -29,7 +29,7 @@
  * SUCH DAMAGE.
  */
 "
-SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.68 2019/12/01 13:56:29 ad Exp $'
+SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.68.2.1 2020/01/18 17:12:59 ad Exp $'
 
 # Script to produce VFS front-end sugar.
 #
@@ -481,7 +481,7 @@
        }
        if (fstrans == "LOCK")
                printf("\terror = vop_pre(%s, &mp, &mpsafe, %s);\n",
-                       argname[0], "(flags & (LK_UPGRADE|LK_DOWNGRADE) ? FST_NO : (flags & LK_NOWAIT ? FST_TRY : FST_YES))");
+                       argname[0], "(!(flags & (LK_SHARED|LK_EXCLUSIVE)) ? FST_NO : (flags & LK_NOWAIT ? FST_TRY : FST_YES))");
        else if (fstrans == "UNLOCK")
                printf("\terror = vop_pre(%s, &mp, &mpsafe, FST_%s);\n",
                        argname[0], "NO");
diff -r 97f91f24bb4e -r 6d1c9650cc4a sys/miscfs/genfs/genfs_vnops.c
--- a/sys/miscfs/genfs/genfs_vnops.c    Sat Jan 18 15:42:02 2020 +0000
+++ b/sys/miscfs/genfs/genfs_vnops.c    Sat Jan 18 17:12:59 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: genfs_vnops.c,v 1.200 2019/12/01 13:56:29 ad Exp $     */
+/*     $NetBSD: genfs_vnops.c,v 1.200.2.1 2020/01/18 17:12:59 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 2019/12/01 13:56:29 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.200.2.1 2020/01/18 17:12:59 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -301,7 +301,7 @@
                        rw_exit(vip->vi_lock);
                        rw_enter(vip->vi_lock, RW_WRITER);
                }
-       } else {
+       } else if ((flags & (LK_EXCLUSIVE | LK_SHARED)) != 0) {
                op = (ISSET(flags, LK_EXCLUSIVE) ? RW_WRITER : RW_READER);
                if (ISSET(flags, LK_NOWAIT)) {
                        if (!rw_tryenter(vip->vi_lock, op))
@@ -355,7 +355,7 @@
                        rw_exit(vip->vi_lock);
                        rw_enter(vip->vi_lock, RW_WRITER);
                }
-       } else {
+       } else if ((flags & (LK_EXCLUSIVE | LK_SHARED)) != 0) {
                op = (ISSET(flags, LK_EXCLUSIVE) ? RW_WRITER : RW_READER);
                if (ISSET(flags, LK_NOWAIT)) {
                        if (!rw_tryenter(vip->vi_lock, op))



Home | Main Index | Thread Index | Old Index