From nobody Fri Apr 07 20:41:55 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PtVfC4P1qz448cK; Fri, 7 Apr 2023 20:41:55 +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 4PtVfC2Y2Bz46Gl; Fri, 7 Apr 2023 20:41:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680900115; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jF2WSv0UAdMCXBjajMcI0Lo15zHZVMHT7wzvSykhfns=; b=y1BpRtowXjDKZcC8/qbpQrBFHXlBcr2sE4KtVODQAkJEopUCTyRFPrC/W+Ii9tgqg0Flat TPTp6SQXaoTCx/yzm+SgJFdKRPEgd3lErGZtYfsaZNPXzV4IAZJYexlDj1iAAeBww9zglJ Br8JL4EFozDJFe+cBEq7kNv6uFoTpKYk7GqAO6pOkCwUhyq79yVU6ni6+bM3YWmRY6Xwya A5Gwt0Cn51bKXdQPEkifcIgV/tnKj8j3GLTp7W0lKr9WwJVBPSobb96vxVdHbgCT6CVTi7 RYKWL8DQ3FTaRcGtJpyEECDGL9D7EYFVlfxVfTB6iVBiAWt09NRyeqDPIQEa/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680900115; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jF2WSv0UAdMCXBjajMcI0Lo15zHZVMHT7wzvSykhfns=; b=t6OSsk/POv3w9nnBI7O/Xu1eIpMllF8y8KBadfQC65WLruZqltgrXe7nWN8GxXT5BWSRol OAkpxPCx010ATNZHks/J+n3eUI88rSydiu2v7tEzRk1452/zYL4hz3Yb1UPeZrOyFfKDti PSmVf/qkkfv6V2K4yA08kNboatzNarFwZPlaZa1LZexLy3MQCbtRZc43bLCSwXT+7tTrVk p85vptYUbEJVa0R8nSWi92QJwFg8Ic76376ujdmhuPx+h92hDuqiuIrhxlWdUrvTGwvkB1 zbzi90B2eJQnJdKC8tnvE0fjY4mkS6jWNWyHeAIm6cQvedZqqsIkHdyh0gSMSA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1680900115; a=rsa-sha256; cv=none; b=YiGk0UzIl5B9PLs8ss5R3ClZxgsTYyP9fWFwh1KRa9UudL9L1l/1pzENpWU2oiDa/N5WBK M5FQjiGLb2wr/LSdo3N/FhoJhfjZiHSbhVV3wP3ovuAIyr7KbQvfk5v0ol9jixzGbsHcx6 x+8RfIlZFhrFyt8xGmH/maHnusgIfgXU3f9uCnpSYPJs/qcSWJf1hqBUuTNw4AGFu68EJA o8fI6C7a7WzFy3wmYeqSKSeaAHJUCv6L0uZb5CxIuH0wCkUx5zvU/N/2/JKRM4w83lgjlu GzXzTe07ksPair59U+edQ32mjpe9dJ9f2k2jgR4qTlR1+Mb0uBE3UYEfqecJPw== 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 4PtVfC0qkRz10Dy; Fri, 7 Apr 2023 20:41:55 +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 337KftBV043934; Fri, 7 Apr 2023 20:41:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 337KftYE043933; Fri, 7 Apr 2023 20:41:55 GMT (envelope-from git) Date: Fri, 7 Apr 2023 20:41:55 GMT Message-Id: <202304072041.337KftYE043933@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 26b964875014 - main - vfs: more informative panic for missing fplookup ops List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/main X-Git-Reftype: branch X-Git-Commit: 26b964875014a0d61f765428b1cb2768917f693c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=26b964875014a0d61f765428b1cb2768917f693c commit 26b964875014a0d61f765428b1cb2768917f693c Author: Mateusz Guzik AuthorDate: 2023-04-07 19:48:33 +0000 Commit: Mateusz Guzik CommitDate: 2023-04-07 20:39:06 +0000 vfs: more informative panic for missing fplookup ops --- sys/kern/vfs_cache.c | 40 ++++++++++++++++++++++++++++++++++++++-- sys/kern/vfs_subr.c | 5 +---- sys/sys/vnode.h | 6 ++++++ 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 2ffa48f12299..294f7740dacf 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3956,6 +3956,20 @@ static int cache_fast_lookup = 1; #define CACHE_FPL_FAILED -2020 +static int +cache_vop_bad_vexec(struct vop_fplookup_vexec_args *v) +{ + vn_printf(v->a_vp, "no proper vop_fplookup_vexec\n"); + panic("no proper vop_fplookup_vexec"); +} + +static int +cache_vop_bad_symlink(struct vop_fplookup_symlink_args *v) +{ + vn_printf(v->a_vp, "no proper vop_fplookup_symlink\n"); + panic("no proper vop_fplookup_symlink"); +} + void cache_vop_vector_register(struct vop_vector *v) { @@ -3974,8 +3988,8 @@ cache_vop_vector_register(struct vop_vector *v) } if (ops == 0) { - v->vop_fplookup_vexec = VOP_PANIC; - v->vop_fplookup_symlink = VOP_PANIC; + v->vop_fplookup_vexec = cache_vop_bad_vexec; + v->vop_fplookup_symlink = cache_vop_bad_symlink; return; } @@ -3990,6 +4004,28 @@ cache_vop_vector_register(struct vop_vector *v) panic("bad vop vector %p", v); } +#ifdef INVARIANTS +void +cache_validate_vop_vector(struct mount *mp, struct vop_vector *vops) +{ + if (mp == NULL) + return; + + if ((mp->mnt_kern_flag & MNTK_FPLOOKUP) == 0) + return; + + if (vops->vop_fplookup_vexec == NULL || + vops->vop_fplookup_vexec == cache_vop_bad_vexec) + panic("bad vop_fplookup_vexec on vector %p for filesystem %s", + vops, mp->mnt_vfc->vfc_name); + + if (vops->vop_fplookup_symlink == NULL || + vops->vop_fplookup_symlink == cache_vop_bad_symlink) + panic("bad vop_fplookup_symlink on vector %p for filesystem %s", + vops, mp->mnt_vfc->vfc_name); +} +#endif + void cache_fast_lookup_enabled_recalc(void) { diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 96adc6ff3493..1da299e93eea 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1800,10 +1800,7 @@ getnewvnode(const char *tag, struct mount *mp, struct vop_vector *vops, KASSERT(vops->registered, ("%s: not registered vector op %p\n", __func__, vops)); - if (mp != NULL && (mp->mnt_kern_flag & MNTK_FPLOOKUP) != 0) { - MPASS(vops->vop_fplookup_vexec != VOP_PANIC); - MPASS(vops->vop_fplookup_symlink != VOP_PANIC); - } + cache_validate_vop_vector(mp, vops); td = curthread; if (td->td_vp_reserved != NULL) { diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 2a62c6d1b659..74514654713a 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -654,6 +654,7 @@ void cache_vop_vector_register(struct vop_vector *); #ifdef INVARIANTS void cache_validate(struct vnode *dvp, struct vnode *vp, struct componentname *cnp); +void cache_validate_vop_vector(struct mount *mp, struct vop_vector *vops); void cache_assert_no_entries(struct vnode *vp); #else static inline void @@ -661,6 +662,11 @@ cache_validate(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) { } +static inline void +cache_validate_vop_vector(struct mount *mp, struct vop_vector *vops) +{ +} + static inline void cache_assert_no_entries(struct vnode *vp) {