Source-Changes-HG archive

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

[src/ad-namecache]: src/sys Set IMNT_SHRLOOKUP and use it for the in-cache ca...



details:   https://anonhg.NetBSD.org/src/rev/686159276eec
branches:  ad-namecache
changeset: 850534:686159276eec
user:      ad <ad%NetBSD.org@localhost>
date:      Sun Jan 19 21:21:54 2020 +0000

description:
Set IMNT_SHRLOOKUP and use it for the in-cache case.  Need to check what
more can be done with tmpfs though, it can probably do the whole lookup.

diffstat:

 sys/fs/cd9660/cd9660_lookup.c     |   7 +++++--
 sys/fs/cd9660/cd9660_vfsops.c     |   6 +++---
 sys/fs/msdosfs/msdosfs_lookup.c   |   8 ++++++--
 sys/fs/msdosfs/msdosfs_vfsops.c   |   5 +++--
 sys/fs/tmpfs/tmpfs_vfsops.c       |   6 +++---
 sys/miscfs/genfs/layer_vnops.c    |   5 +++--
 sys/miscfs/nullfs/null_vfsops.c   |   6 +++---
 sys/miscfs/procfs/procfs_vfsops.c |   6 +++---
 sys/ufs/chfs/chfs_vnops.c         |   6 +++++-
 sys/ufs/ext2fs/ext2fs_lookup.c    |  24 ++++++++++++++----------
 sys/ufs/ext2fs/ext2fs_vfsops.c    |   6 +++---
 sys/ufs/ffs/ffs_vfsops.c          |   6 +++---
 sys/ufs/lfs/lfs_vfsops.c          |   5 +++--
 sys/ufs/lfs/ulfs_lookup.c         |  25 +++++++++++++++----------
 sys/ufs/ufs/ufs_lookup.c          |  26 ++++++++++++++++----------
 15 files changed, 88 insertions(+), 59 deletions(-)

diffs (truncated from 476 to 300 lines):

diff -r 38928c569f45 -r 686159276eec sys/fs/cd9660/cd9660_lookup.c
--- a/sys/fs/cd9660/cd9660_lookup.c     Sun Jan 19 21:19:25 2020 +0000
+++ b/sys/fs/cd9660/cd9660_lookup.c     Sun Jan 19 21:21:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd9660_lookup.c,v 1.30 2015/03/28 19:24:05 maxv Exp $  */
+/*     $NetBSD: cd9660_lookup.c,v 1.30.24.1 2020/01/19 21:21:54 ad Exp $       */
 
 /*-
  * Copyright (c) 1989, 1993, 1994
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd9660_lookup.c,v 1.30 2015/03/28 19:24:05 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd9660_lookup.c,v 1.30.24.1 2020/01/19 21:21:54 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/namei.h>
@@ -152,6 +152,9 @@
                         cnp->cn_nameiop, cnp->cn_flags, NULL, vpp)) {
                return *vpp == NULLVP ? ENOENT : 0;
        }
+       /* May need to restart the lookup with an exclusive lock. */
+       if (VOP_ISLOCKED(vdp) != LK_EXCLUSIVE)
+               return ENOLCK;
 
        len = cnp->cn_namelen;
        name = cnp->cn_nameptr;
diff -r 38928c569f45 -r 686159276eec sys/fs/cd9660/cd9660_vfsops.c
--- a/sys/fs/cd9660/cd9660_vfsops.c     Sun Jan 19 21:19:25 2020 +0000
+++ b/sys/fs/cd9660/cd9660_vfsops.c     Sun Jan 19 21:21:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd9660_vfsops.c,v 1.93.18.1 2020/01/17 21:47:33 ad Exp $       */
+/*     $NetBSD: cd9660_vfsops.c,v 1.93.18.2 2020/01/19 21:21:54 ad Exp $       */
 
 /*-
  * Copyright (c) 1994
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.93.18.1 2020/01/17 21:47:33 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.93.18.2 2020/01/19 21:21:54 ad Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -444,7 +444,7 @@
        mp->mnt_stat.f_fsid = mp->mnt_stat.f_fsidx.__fsid_val[0];
        mp->mnt_stat.f_namemax = ISO_MAXNAMLEN;
        mp->mnt_flag |= MNT_LOCAL;
-       mp->mnt_iflag |= IMNT_MPSAFE;
+       mp->mnt_iflag |= IMNT_MPSAFE | IMNT_SHRLOOKUP;
        mp->mnt_dev_bshift = iso_bsize;
        mp->mnt_fs_bshift = isomp->im_bshift;
        isomp->im_mountp = mp;
diff -r 38928c569f45 -r 686159276eec sys/fs/msdosfs/msdosfs_lookup.c
--- a/sys/fs/msdosfs/msdosfs_lookup.c   Sun Jan 19 21:19:25 2020 +0000
+++ b/sys/fs/msdosfs/msdosfs_lookup.c   Sun Jan 19 21:21:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs_lookup.c,v 1.35 2016/01/30 09:59:27 mlelstv Exp $      */
+/*     $NetBSD: msdosfs_lookup.c,v 1.35.24.1 2020/01/19 21:21:54 ad Exp $      */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -52,7 +52,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_lookup.c,v 1.35 2016/01/30 09:59:27 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_lookup.c,v 1.35.24.1 2020/01/19 21:21:54 ad Exp $");
 
 #include <sys/param.h>
 
@@ -161,6 +161,10 @@
                return *vpp == NULLVP ? ENOENT: 0;
        }
 
+       /* May need to restart the lookup with an exclusive lock. */
+       if (VOP_ISLOCKED(vdp) != LK_EXCLUSIVE)
+               return ENOLCK;
+
        /*
         * If they are going after the . or .. entry in the root directory,
         * they won't find it.  DOS filesystems don't have them in the root
diff -r 38928c569f45 -r 686159276eec sys/fs/msdosfs/msdosfs_vfsops.c
--- a/sys/fs/msdosfs/msdosfs_vfsops.c   Sun Jan 19 21:19:25 2020 +0000
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c   Sun Jan 19 21:21:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs_vfsops.c,v 1.130.6.1 2020/01/17 21:47:33 ad Exp $      */
+/*     $NetBSD: msdosfs_vfsops.c,v 1.130.6.2 2020/01/19 21:21:54 ad Exp $      */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.130.6.1 2020/01/17 21:47:33 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.130.6.2 2020/01/19 21:21:54 ad Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -867,6 +867,7 @@
        mp->mnt_stat.f_fsid = mp->mnt_stat.f_fsidx.__fsid_val[0];
        mp->mnt_stat.f_namemax = MSDOSFS_NAMEMAX(pmp);
        mp->mnt_flag |= MNT_LOCAL;
+       mp->mnt_iflag |= IMNT_SHRLOOKUP;
        mp->mnt_dev_bshift = pmp->pm_bnshift;
        mp->mnt_fs_bshift = pmp->pm_cnshift;
 
diff -r 38928c569f45 -r 686159276eec sys/fs/tmpfs/tmpfs_vfsops.c
--- a/sys/fs/tmpfs/tmpfs_vfsops.c       Sun Jan 19 21:19:25 2020 +0000
+++ b/sys/fs/tmpfs/tmpfs_vfsops.c       Sun Jan 19 21:21:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tmpfs_vfsops.c,v 1.75.2.1 2020/01/17 21:47:34 ad Exp $ */
+/*     $NetBSD: tmpfs_vfsops.c,v 1.75.2.2 2020/01/19 21:21:54 ad Exp $ */
 
 /*
  * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.75.2.1 2020/01/17 21:47:34 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.75.2.2 2020/01/19 21:21:54 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -182,7 +182,7 @@
        mp->mnt_stat.f_namemax = TMPFS_MAXNAMLEN;
        mp->mnt_fs_bshift = PAGE_SHIFT;
        mp->mnt_dev_bshift = DEV_BSHIFT;
-       mp->mnt_iflag |= IMNT_MPSAFE | IMNT_CAN_RWTORO;
+       mp->mnt_iflag |= IMNT_MPSAFE | IMNT_CAN_RWTORO | IMNT_SHRLOOKUP;
        vfs_getnewfsid(mp);
 
        /* Allocate the tmpfs mount structure and fill it. */
diff -r 38928c569f45 -r 686159276eec sys/miscfs/genfs/layer_vnops.c
--- a/sys/miscfs/genfs/layer_vnops.c    Sun Jan 19 21:19:25 2020 +0000
+++ b/sys/miscfs/genfs/layer_vnops.c    Sun Jan 19 21:21:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: layer_vnops.c,v 1.67 2017/06/04 08:05:42 hannken Exp $ */
+/*     $NetBSD: layer_vnops.c,v 1.67.12.1 2020/01/19 21:21:54 ad Exp $ */
 
 /*
  * Copyright (c) 1999 National Aeronautics & Space Administration
@@ -170,7 +170,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.67 2017/06/04 08:05:42 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.67.12.1 2020/01/19 21:21:54 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -384,6 +384,7 @@
                vrele(lvp);
        } else if (lvp != NULL) {
                /* Note: dvp and ldvp are both locked. */
+               KASSERT(error != ENOLCK);
                error = layer_node_create(dvp->v_mount, lvp, ap->a_vpp);
                if (error) {
                        vrele(lvp);
diff -r 38928c569f45 -r 686159276eec sys/miscfs/nullfs/null_vfsops.c
--- a/sys/miscfs/nullfs/null_vfsops.c   Sun Jan 19 21:19:25 2020 +0000
+++ b/sys/miscfs/nullfs/null_vfsops.c   Sun Jan 19 21:21:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: null_vfsops.c,v 1.96 2019/12/15 20:30:56 joerg Exp $   */
+/*     $NetBSD: null_vfsops.c,v 1.96.2.1 2020/01/19 21:21:55 ad Exp $  */
 
 /*
  * Copyright (c) 1999 National Aeronautics & Space Administration
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: null_vfsops.c,v 1.96 2019/12/15 20:30:56 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: null_vfsops.c,v 1.96.2.1 2020/01/19 21:21:55 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -140,7 +140,7 @@
        /* Create the mount point. */
        nmp = kmem_zalloc(sizeof(struct null_mount), KM_SLEEP);
        mp->mnt_data = nmp;
-       mp->mnt_iflag |= IMNT_MPSAFE;
+       mp->mnt_iflag |= IMNT_MPSAFE | IMNT_SHRLOOKUP;
 
        /*
         * Make sure that the mount point is sufficiently initialized
diff -r 38928c569f45 -r 686159276eec sys/miscfs/procfs/procfs_vfsops.c
--- a/sys/miscfs/procfs/procfs_vfsops.c Sun Jan 19 21:19:25 2020 +0000
+++ b/sys/miscfs/procfs/procfs_vfsops.c Sun Jan 19 21:21:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: procfs_vfsops.c,v 1.101.6.1 2020/01/17 21:47:36 ad Exp $       */
+/*     $NetBSD: procfs_vfsops.c,v 1.101.6.2 2020/01/19 21:21:55 ad Exp $       */
 
 /*
  * Copyright (c) 1993
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.101.6.1 2020/01/17 21:47:36 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.101.6.2 2020/01/19 21:21:55 ad Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -173,7 +173,7 @@
        else
                pmnt->pmnt_flags = 0;
 
-       mp->mnt_iflag |= IMNT_MPSAFE;
+       mp->mnt_iflag |= IMNT_MPSAFE | IMNT_SHRLOOKUP;
        return error;
 }
 
diff -r 38928c569f45 -r 686159276eec sys/ufs/chfs/chfs_vnops.c
--- a/sys/ufs/chfs/chfs_vnops.c Sun Jan 19 21:19:25 2020 +0000
+++ b/sys/ufs/chfs/chfs_vnops.c Sun Jan 19 21:21:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chfs_vnops.c,v 1.34.4.1 2020/01/17 21:47:37 ad Exp $   */
+/*     $NetBSD: chfs_vnops.c,v 1.34.4.2 2020/01/19 21:21:55 ad Exp $   */
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -90,6 +90,10 @@
                return (*vpp == NULLVP ? ENOENT : 0);
        }
 
+       /* May need to restart the lookup with an exclusive lock. */
+       if (VOP_ISLOCKED(dvp) != LK_EXCLUSIVE)
+               return ENOLCK;
+
        ip = VTOI(dvp);
        ump = VFSTOUFS(dvp->v_mount);
        chmp = ump->um_chfs;
diff -r 38928c569f45 -r 686159276eec sys/ufs/ext2fs/ext2fs_lookup.c
--- a/sys/ufs/ext2fs/ext2fs_lookup.c    Sun Jan 19 21:19:25 2020 +0000
+++ b/sys/ufs/ext2fs/ext2fs_lookup.c    Sun Jan 19 21:21:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ext2fs_lookup.c,v 1.88 2016/08/23 06:40:25 christos Exp $      */
+/*     $NetBSD: ext2fs_lookup.c,v 1.88.22.1 2020/01/19 21:21:55 ad Exp $       */
 
 /*
  * Modified for NetBSD 1.2E
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.88 2016/08/23 06:40:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.88.22.1 2020/01/19 21:21:55 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -313,14 +313,6 @@
        *vpp = NULL;
 
        /*
-        * Produce the auxiliary lookup results into i_crap. Increment
-        * its serial number so elsewhere we can tell if we're using
-        * stale results. This should not be done this way. XXX.
-        */
-       results = &dp->i_crap;
-       dp->i_crapcounter++;
-
-       /*
         * Check accessiblity of directory.
         */
        if ((error = VOP_ACCESS(vdp, VEXEC, cred)) != 0)
@@ -342,6 +334,18 @@
                return *vpp == NULLVP ? ENOENT : 0;
        }
 
+       /* May need to restart the lookup with an exclusive lock. */
+       if (VOP_ISLOCKED(vdp) != LK_EXCLUSIVE)
+               return ENOLCK;
+
+       /*
+        * Produce the auxiliary lookup results into i_crap. Increment
+        * its serial number so elsewhere we can tell if we're using
+        * stale results. This should not be done this way. XXX.
+        */
+       results = &dp->i_crap;
+       dp->i_crapcounter++;
+
        /*
         * Suppress search for slots unless creating
         * file and at end of pathname, in which case
diff -r 38928c569f45 -r 686159276eec sys/ufs/ext2fs/ext2fs_vfsops.c
--- a/sys/ufs/ext2fs/ext2fs_vfsops.c    Sun Jan 19 21:19:25 2020 +0000
+++ b/sys/ufs/ext2fs/ext2fs_vfsops.c    Sun Jan 19 21:21:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ext2fs_vfsops.c,v 1.214.4.1 2020/01/17 21:47:37 ad Exp $       */
+/*     $NetBSD: ext2fs_vfsops.c,v 1.214.4.2 2020/01/19 21:21:55 ad Exp $       */
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1994
@@ -60,7 +60,7 @@
  */



Home | Main Index | Thread Index | Old Index