Date: Thu, 27 Aug 2020 22:14:59 +0000 (UTC) From: Kirk McKusick <mckusick@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364895 - head/sys/kern Message-ID: <202008272214.07RMExfE080414@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 &&
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008272214.07RMExfE080414>