svn commit: r364064 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Mon Aug 10 10:33:41 UTC 2020


Author: mjg
Date: Mon Aug 10 10:33:40 2020
New Revision: 364064
URL: https://svnweb.freebsd.org/changeset/base/364064

Log:
  vfs: disallow NOCACHE with LOOKUP
  
  This means there is no expectation lookup will purge the terminal entry,
  which simplifies lockless lookup.
  
  Tested by:	pho
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/kern/vfs_lookup.c
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_lookup.c
==============================================================================
--- head/sys/kern/vfs_lookup.c	Mon Aug 10 10:31:17 2020	(r364063)
+++ head/sys/kern/vfs_lookup.c	Mon Aug 10 10:33:40 2020	(r364064)
@@ -484,6 +484,9 @@ namei(struct nameidata *ndp)
 	    ("namei: nameiop contaminated with flags"));
 	KASSERT((cnp->cn_flags & OPMASK) == 0,
 	    ("namei: flags contaminated with nameiops"));
+	if (cnp->cn_flags & NOCACHE)
+		KASSERT(cnp->cn_nameiop != LOOKUP,
+		    ("%s: NOCACHE passed with LOOKUP", __func__));
 	MPASS(ndp->ni_startdir == NULL || ndp->ni_startdir->v_type == VDIR ||
 	    ndp->ni_startdir->v_type == VBAD);
 

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Mon Aug 10 10:31:17 2020	(r364063)
+++ head/sys/kern/vfs_subr.c	Mon Aug 10 10:33:40 2020	(r364064)
@@ -408,7 +408,7 @@ sysctl_try_reclaim_vnode(SYSCTL_HANDLER_ARGS)
 
 	buf[req->newlen] = '\0';
 
-	ndflags = LOCKLEAF | NOFOLLOW | AUDITVNODE1 | NOCACHE | SAVENAME;
+	ndflags = LOCKLEAF | NOFOLLOW | AUDITVNODE1 | SAVENAME;
 	NDINIT(&nd, LOOKUP, ndflags, UIO_SYSSPACE, buf, curthread);
 	if ((error = namei(&nd)) != 0)
 		goto out;


More information about the svn-src-all mailing list