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 <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
This commit is contained in:
Andrew Deason 2022-10-26 15:39:30 -05:00
parent 890ae8e4ff
commit 407eadbcd7

View File

@ -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