Author: mckusick
Date: Thu Aug 27 22:14:58 2020
New Revision: 364895
URL: https://svnweb.freebsd.org/changeset/base/364895

Log:
  Add a comment to clarify when and why cached names are deleted
  during pathname lookup.
  
  Reviewed by:  kib
  MFC after:    3 days
  Sponsored by: Netflix

Modified:
  head/sys/kern/vfs_lookup.c

Modified: head/sys/kern/vfs_lookup.c
==============================================================================
--- head/sys/kern/vfs_lookup.c  Thu Aug 27 21:47:43 2020        (r364894)
+++ head/sys/kern/vfs_lookup.c  Thu Aug 27 22:14:58 2020        (r364895)
@@ -785,6 +785,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 &&
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to