From owner-dev-commits-src-branches@freebsd.org Sat Apr 10 06:02:07 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 047B55CF9BB; Sat, 10 Apr 2021 06:02:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FHPXZ4Bsgz4R4g; Sat, 10 Apr 2021 06:02:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5CCEE3F9E; Sat, 10 Apr 2021 06:02:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13A6262K015205; Sat, 10 Apr 2021 06:02:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A6264L015204; Sat, 10 Apr 2021 06:02:06 GMT (envelope-from git) Date: Sat, 10 Apr 2021 06:02:06 GMT Message-Id: <202104100602.13A6264L015204@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 4cb1b49b3c98 - stable/13 - cache: assorted comment fixups MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4cb1b49b3c985e97933a6194646bab47ece82400 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 06:02:07 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=4cb1b49b3c985e97933a6194646bab47ece82400 commit 4cb1b49b3c985e97933a6194646bab47ece82400 Author: Mateusz Guzik AuthorDate: 2021-02-09 16:06:27 +0000 Commit: Mateusz Guzik 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));