Date: Sat, 10 Apr 2021 06:02:06 GMT From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 4cb1b49b3c98 - stable/13 - cache: assorted comment fixups Message-ID: <202104100602.13A6264L015204@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=4cb1b49b3c985e97933a6194646bab47ece82400 commit 4cb1b49b3c985e97933a6194646bab47ece82400 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2021-02-09 16:06:27 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2021-04-10 05:57:55 +0000 cache: assorted comment fixups (cherry picked from commit 39e0c3f686387605591f8f646ceec53613619525) --- sys/kern/vfs_cache.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 21eb436681fc..fef1e31d197b 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -5268,6 +5268,10 @@ cache_fplookup_parse(struct cache_fpl *fpl) cache_fpl_pathlen_sub(fpl, cnp->cn_namelen); #ifdef INVARIANTS + /* + * cache_get_hash only accepts lengths up to NAME_MAX. This is fine since + * we are going to fail this lookup with ENAMETOOLONG (see below). + */ if (cnp->cn_namelen <= NAME_MAX) { if (fpl->hash != cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp)) { panic("%s: mismatched hash for [%s] len %ld", __func__, @@ -5359,7 +5363,7 @@ cache_fplookup_skip_slashes(struct cache_fpl *fpl) * manner relying on an invariant that a non-directory vnode will get a miss. * In this case cn_nameptr[0] == '\0' and cn_namelen == 0. * - * Thus for a path like "foo/bar/" the code unwinds the state back to 'bar/' + * Thus for a path like "foo/bar/" the code unwinds the state back to "bar/" * and denotes this is the last path component, which avoids looping back. * * Only plain lookups are supported for now to restrict corner cases to handle. @@ -5454,14 +5458,14 @@ cache_fplookup_trailingslash(struct cache_fpl *fpl) #endif /* - * The previous directory is this one. + * If this was a "./" lookup the parent directory is already correct. */ if (cnp->cn_nameptr[0] == '.' && cnp->cn_namelen == 1) { return (0); } /* - * The previous directory is something else. + * Otherwise we need to look it up. */ tvp = fpl->tvp; ncp = atomic_load_consume_ptr(&tvp->v_cache_dd); @@ -5495,10 +5499,11 @@ cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error) dvp_seqc = fpl->dvp_seqc; /* - * TODO: Due to ignoring slashes lookup will perform a permission check - * on the last dir when it should not have. If it fails, we get here. - * It is possible possible to fix it up fully without resorting to - * regular lookup, but for now just abort. + * TODO: Due to ignoring trailing slashes lookup will perform a + * permission check on the last dir when it should not be doing it. It + * may fail, but said failure should be ignored. It is possible to fix + * it up fully without resorting to regular lookup, but for now just + * abort. */ if (cache_fpl_istrailingslash(fpl)) { return (cache_fpl_aborted(fpl));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104100602.13A6264L015204>