Source-Changes-HG archive

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

[src/ad-namecache]: src/sys/kern Use LOCKLEAF in the few cases it's useful fo...



details:   https://anonhg.NetBSD.org/src/rev/081392be94f9
branches:  ad-namecache
changeset: 982998:081392be94f9
user:      ad <ad%NetBSD.org@localhost>
date:      Sun Jan 19 21:23:36 2020 +0000

description:
Use LOCKLEAF in the few cases it's useful for ffs/tmpfs/nullfs.  Others need
to be checked.

diffstat:

 sys/kern/vfs_syscalls.c |  10 +++++-----
 sys/kern/vfs_vnops.c    |   9 ++++++---
 2 files changed, 11 insertions(+), 8 deletions(-)

diffs (75 lines):

diff -r 2fa2590b1294 -r 081392be94f9 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Sun Jan 19 21:21:54 2020 +0000
+++ b/sys/kern/vfs_syscalls.c   Sun Jan 19 21:23:36 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.c,v 1.539.2.1 2020/01/17 21:47:35 ad Exp $        */
+/*     $NetBSD: vfs_syscalls.c,v 1.539.2.2 2020/01/19 21:23:36 ad Exp $        */
 
 /*-
  * Copyright (c) 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.539.2.1 2020/01/17 21:47:35 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.539.2.2 2020/01/19 21:23:36 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -1532,7 +1532,7 @@
        if (error) {
                return error;
        }
-       NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | TRYEMULROOT, pb);
+       NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | LOCKSHARED | TRYEMULROOT, pb);
        if ((error = namei(&nd)) != 0) {
                pathbuf_destroy(pb);
                return error;
@@ -2996,7 +2996,7 @@
                return EINVAL;
        }
 
-       nd_flag = FOLLOW | LOCKLEAF | TRYEMULROOT;
+       nd_flag = FOLLOW | LOCKLEAF | LOCKSHARED | TRYEMULROOT;
        if (flags & AT_SYMLINK_NOFOLLOW)
                nd_flag &= ~FOLLOW;
 
@@ -3222,7 +3222,7 @@
        if (error) {
                return error;
        }
-       NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | TRYEMULROOT, pb);
+       NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | LOCKSHARED | TRYEMULROOT, pb);
        if ((error = fd_nameiat(l, fdat, &nd)) != 0) {
                pathbuf_destroy(pb);
                return error;
diff -r 2fa2590b1294 -r 081392be94f9 sys/kern/vfs_vnops.c
--- a/sys/kern/vfs_vnops.c      Sun Jan 19 21:21:54 2020 +0000
+++ b/sys/kern/vfs_vnops.c      Sun Jan 19 21:23:36 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_vnops.c,v 1.204.2.1 2020/01/17 21:47:35 ad Exp $   */
+/*     $NetBSD: vfs_vnops.c,v 1.204.2.2 2020/01/19 21:23:36 ad Exp $   */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.204.2.1 2020/01/17 21:47:35 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.204.2.2 2020/01/19 21:23:36 ad Exp $");
 
 #include "veriexec.h"
 
@@ -163,7 +163,10 @@
                        ndp->ni_cnd.cn_flags |= FOLLOW;
        } else {
                ndp->ni_cnd.cn_nameiop = LOOKUP;
-               ndp->ni_cnd.cn_flags |= LOCKLEAF;
+               if ((fmode & O_TRUNC) == 0) /* XXXAD check nfs etc */
+                       ndp->ni_cnd.cn_flags |= LOCKLEAF | LOCKSHARED;
+               else
+                       ndp->ni_cnd.cn_flags |= LOCKLEAF;
                if ((fmode & O_NOFOLLOW) == 0)
                        ndp->ni_cnd.cn_flags |= FOLLOW;
        }



Home | Main Index | Thread Index | Old Index