Date: Thu, 4 Mar 2021 20:08:48 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: bd7a41bed081 - releng/13.0 - Add nameicap_cleanup_from(), to clean tracker list starting from some element Message-ID: <202103042008.124K8m8T042034@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch releng/13.0 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bd7a41bed0818edf233743a96ed1c394e8e34936 commit bd7a41bed0818edf233743a96ed1c394e8e34936 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-02-28 00:14:43 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-03-04 20:07:58 +0000 Add nameicap_cleanup_from(), to clean tracker list starting from some element Approved by: re (gjb) (cherry picked from commit e8a2862aa0384c75603f801625e309a3dae0ed05) --- sys/kern/vfs_lookup.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index cdd4a914239f..abc01c73e24c 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -192,19 +192,26 @@ nameicap_tracker_add(struct nameidata *ndp, struct vnode *dp) } static void -nameicap_cleanup(struct nameidata *ndp) +nameicap_cleanup_from(struct nameidata *ndp, struct nameicap_tracker *first) { struct nameicap_tracker *nt, *nt1; - KASSERT(TAILQ_EMPTY(&ndp->ni_cap_tracker) || - (ndp->ni_lcf & NI_LCF_CAP_DOTDOT) != 0, ("not strictrelative")); - TAILQ_FOREACH_SAFE(nt, &ndp->ni_cap_tracker, nm_link, nt1) { + nt = first; + TAILQ_FOREACH_FROM_SAFE(nt, &ndp->ni_cap_tracker, nm_link, nt1) { TAILQ_REMOVE(&ndp->ni_cap_tracker, nt, nm_link); vdrop(nt->dp); free(nt, M_NAMEITRACKER); } } +static void +nameicap_cleanup(struct nameidata *ndp) +{ + KASSERT(TAILQ_EMPTY(&ndp->ni_cap_tracker) || + (ndp->ni_lcf & NI_LCF_CAP_DOTDOT) != 0, ("not strictrelative")); + nameicap_cleanup_from(ndp, NULL); +} + /* * For dotdot lookups in capability mode, only allow the component * lookup to succeed if the resulting directory was already traversed
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103042008.124K8m8T042034>