Date: Mon, 1 Feb 2021 12:40:41 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: aa411f6ba17b - stable/13 - cache: assorted cleanups Message-ID: <202102011240.111Cefa0094805@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=aa411f6ba17b91af720129bd7593df4c7093f8a4 commit aa411f6ba17b91af720129bd7593df4c7093f8a4 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2021-01-24 20:04:01 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2021-02-01 12:39:15 +0000 cache: assorted cleanups (cherry picked from commit 868643e7229b7959024880cda396fef87602b948) --- sys/kern/vfs_cache.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 9d3b935a3047..e3098ac7c5d5 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -5079,54 +5079,54 @@ cache_fplookup_is_mp(struct cache_fpl *fpl) */ #ifdef INVARIANTS static void -cache_fpl_pathlen_dec(struct cache_fpl *fpl) +cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) { - cache_fpl_pathlen_sub(fpl, 1); + fpl->debug.ni_pathlen += n; + KASSERT(fpl->debug.ni_pathlen <= PATH_MAX, + ("%s: pathlen overflow to %zd\n", __func__, fpl->debug.ni_pathlen)); } static void -cache_fpl_pathlen_inc(struct cache_fpl *fpl) +cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) { - cache_fpl_pathlen_add(fpl, 1); + fpl->debug.ni_pathlen -= n; + KASSERT(fpl->debug.ni_pathlen <= PATH_MAX, + ("%s: pathlen underflow to %zd\n", __func__, fpl->debug.ni_pathlen)); } static void -cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) +cache_fpl_pathlen_inc(struct cache_fpl *fpl) { - fpl->debug.ni_pathlen += n; - KASSERT(fpl->debug.ni_pathlen <= PATH_MAX, - ("%s: pathlen overflow to %zd\n", __func__, fpl->debug.ni_pathlen)); + cache_fpl_pathlen_add(fpl, 1); } static void -cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) +cache_fpl_pathlen_dec(struct cache_fpl *fpl) { - fpl->debug.ni_pathlen -= n; - KASSERT(fpl->debug.ni_pathlen <= PATH_MAX, - ("%s: pathlen underflow to %zd\n", __func__, fpl->debug.ni_pathlen)); + cache_fpl_pathlen_sub(fpl, 1); } #else -static void __always_inline -cache_fpl_pathlen_dec(struct cache_fpl *fpl) +static void +cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) { } -static void __always_inline -cache_fpl_pathlen_inc(struct cache_fpl *fpl) +static void +cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) { } static void -cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) +cache_fpl_pathlen_inc(struct cache_fpl *fpl) { } static void -cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) +cache_fpl_pathlen_dec(struct cache_fpl *fpl) { } #endif @@ -5258,7 +5258,7 @@ cache_fplookup_parse_advance(struct cache_fpl *fpl) * * Lockless lookup tries to elide checking for spurious slashes and should they * be present is guaranteed to fail to find an entry. In this case the caller - * must check if the name starts with a slash and this call routine. It is + * must check if the name starts with a slash and call this routine. It is * going to fast forward across the spurious slashes and set the state up for * retry. */ @@ -5342,11 +5342,13 @@ cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error) * Hack: handle O_SEARCH. * * Open Group Base Specifications Issue 7, 2018 edition states: + * <quote> * If the access mode of the open file description associated with the * file descriptor is not O_SEARCH, the function shall check whether * directory searches are permitted using the current permissions of * the directory underlying the file descriptor. If the access mode is * O_SEARCH, the function shall not perform the check. + * </quote> * * Regular lookup tests for the NOEXECCHECK flag for every path * component to decide whether to do the permission check. However,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102011240.111Cefa0094805>