svn commit: r364983 - stable/12/sys/kern

Kirk McKusick mckusick at FreeBSD.org
Mon Aug 31 05:25:14 UTC 2020


Author: mckusick
Date: Mon Aug 31 05:25:13 2020
New Revision: 364983
URL: https://svnweb.freebsd.org/changeset/base/364983

Log:
  MFC of 364895
  
  Comment on when and why pathnames are deleted from the name cache.

Modified:
  stable/12/sys/kern/vfs_lookup.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/vfs_lookup.c
==============================================================================
--- stable/12/sys/kern/vfs_lookup.c	Mon Aug 31 01:45:48 2020	(r364982)
+++ stable/12/sys/kern/vfs_lookup.c	Mon Aug 31 05:25:13 2020	(r364983)
@@ -663,6 +663,16 @@ lookup(struct nameidata *ndp)
 	wantparent = cnp->cn_flags & (LOCKPARENT | WANTPARENT);
 	KASSERT(cnp->cn_nameiop == LOOKUP || wantparent,
 	    ("CREATE, DELETE, RENAME require LOCKPARENT or WANTPARENT."));
+	/*
+	 * When set to zero, docache causes the last component of the
+	 * pathname to be deleted from the cache and the full lookup
+	 * of the name to be done (via VOP_CACHEDLOOKUP()). Often
+	 * filesystems need some pre-computed values that are made
+	 * during the full lookup, for instance UFS sets dp->i_offset.
+	 *
+	 * The docache variable is set to zero when requested by the
+	 * NOCACHE flag and for all modifying operations except CREATE.
+	 */
 	docache = (cnp->cn_flags & NOCACHE) ^ NOCACHE;
 	if (cnp->cn_nameiop == DELETE ||
 	    (wantparent && cnp->cn_nameiop != CREATE &&


More information about the svn-src-stable-12 mailing list