From 407eadbcd787dabd22de572e86f170f0cad2bbaa Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Wed, 26 Oct 2022 15:39:30 -0500 Subject: [PATCH] FBSD: Use VFS_VOP_VECTOR_REGISTER FreeBSD commit 6fa079fc3f5e7e120f166420c6f0c60f701ba9ae (vfs: flatten vop vectors) changed how the .vop_default field in struct vop_vector works. Previously, we just set .vop_default to a default set of function pointers (default_vnodeops), and any caller would use that if any of our function pointers were NULL. After commit 6fa079fc3f, instead all declared struct vop_vector's must call vfs_vector_op_register(), which merges the .vop_default contents into the main struct vop_vector, and so callers can call the needed function pointer unconditionally. Most filesystems use VFS_VOP_VECTOR_REGISTER() to do this, which arranges for vfs_vector_op_register() to be called on boot or module load. If we don't call vfs_vector_op_register(), then we get a kernel panic when mounting AFS, since various vnode ops are NULL (such as vop_lock1). So to fix this, call VFS_VOP_VECTOR_REGISTER() when available. Change-Id: I6137e3ed0b21fbda5c3d3df300dfe9ae4cb3925d Reviewed-on: https://gerrit.openafs.org/15173 Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason Tested-by: BuildBot --- src/afs/FBSD/osi_vnodeops.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/afs/FBSD/osi_vnodeops.c b/src/afs/FBSD/osi_vnodeops.c index bc226fd8eb..3f9788939f 100644 --- a/src/afs/FBSD/osi_vnodeops.c +++ b/src/afs/FBSD/osi_vnodeops.c @@ -1332,3 +1332,6 @@ struct vop_vector afs_vnodeops = { .vop_symlink = afs_vop_symlink, .vop_write = afs_vop_write, }; +#if __FreeBSD_version >= 1300067 +VFS_VOP_VECTOR_REGISTER(afs_vnodeops); +#endif