Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Aug 2020 05:25:13 +0000 (UTC)
From:      Kirk McKusick <mckusick@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r364983 - stable/12/sys/kern
Message-ID:  <202008310525.07V5PD1w039746@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 &&



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008310525.07V5PD1w039746>