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
This commit is contained in:
Kirk McKusick 2020-08-27 22:14:58 +00:00
parent 962619075c
commit 66ac5b2c5a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364895

View File

@ -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 &&