git: e237e2ba5f4f - main - vfs: only allow doomed vnodes to return EOPNOTSUPP for fplookup vops

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Thu, 06 Apr 2023 15:45:37 UTC
The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=e237e2ba5f4fc008eaf6e306e69fb9d98f5de27d

commit e237e2ba5f4fc008eaf6e306e69fb9d98f5de27d
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2021-11-03 21:02:35 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2023-04-06 15:20:41 +0000

    vfs: only allow doomed vnodes to return EOPNOTSUPP for fplookup vops
    
    This helps asserting that they are provided by filesystems indicating
    they do it.
---
 sys/kern/vfs_subr.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 84b56ceec727..5c1819800d96 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -5545,10 +5545,17 @@ vop_fplookup_vexec_debugpre(void *ap __unused)
 }
 
 void
-vop_fplookup_vexec_debugpost(void *ap __unused, int rc __unused)
+vop_fplookup_vexec_debugpost(void *ap, int rc)
 {
+	struct vop_fplookup_vexec_args *a;
+	struct vnode *vp;
+
+	a = ap;
+	vp = a->a_vp;
 
 	VFS_SMR_ASSERT_ENTERED();
+	if (rc == EOPNOTSUPP)
+		VNPASS(VN_IS_DOOMED(vp), vp);
 }
 
 void