diff options
| author | Mateusz Guzik <mjg@FreeBSD.org> | 2021-11-03 20:26:41 +0000 |
|---|---|---|
| committer | Mateusz Guzik <mjg@FreeBSD.org> | 2023-04-06 15:20:41 +0000 |
| commit | 5f6df177758b9dff88e4b6069aeb2359e8b0c493 (patch) | |
| tree | 977f1642ce48358fec1a9c3e55b613a2e0bf1155 | |
| parent | c7f6c2a50b97411c7ef8652e77fabf799dfb8750 (diff) | |
| -rw-r--r-- | sys/kern/vfs_cache.c | 34 | ||||
| -rw-r--r-- | sys/sys/vnode.h | 1 | ||||
| -rw-r--r-- | sys/tools/vnode_if.awk | 2 |
3 files changed, 37 insertions, 0 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index cc93158078d3..2ffa48f12299 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3957,6 +3957,40 @@ static int cache_fast_lookup = 1; #define CACHE_FPL_FAILED -2020 void +cache_vop_vector_register(struct vop_vector *v) +{ + size_t ops; + + ops = 0; + if (v->vop_fplookup_vexec != NULL) { + ops++; + } + if (v->vop_fplookup_symlink != NULL) { + ops++; + } + + if (ops == 2) { + return; + } + + if (ops == 0) { + v->vop_fplookup_vexec = VOP_PANIC; + v->vop_fplookup_symlink = VOP_PANIC; + return; + } + + printf("%s: invalid vop vector %p -- either all or none fplookup vops " + "need to be provided", __func__, v); + if (v->vop_fplookup_vexec == NULL) { + printf("%s: missing vop_fplookup_vexec\n", __func__); + } + if (v->vop_fplookup_symlink == NULL) { + printf("%s: missing vop_fplookup_symlink\n", __func__); + } + panic("bad vop vector %p", v); +} + +void cache_fast_lookup_enabled_recalc(void) { int lookup_flag; diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index a3eb00f0fe7c..2a62c6d1b659 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -650,6 +650,7 @@ int cache_symlink_resolve(struct cache_fpl *fpl, const char *string, void cache_vop_rename(struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp, struct vnode *tvp, struct componentname *fcnp, struct componentname *tcnp); void cache_vop_rmdir(struct vnode *dvp, struct vnode *vp); +void cache_vop_vector_register(struct vop_vector *); #ifdef INVARIANTS void cache_validate(struct vnode *dvp, struct vnode *vp, struct componentname *cnp); diff --git a/sys/tools/vnode_if.awk b/sys/tools/vnode_if.awk index 415c33c52420..7fdaca208a9b 100644 --- a/sys/tools/vnode_if.awk +++ b/sys/tools/vnode_if.awk @@ -473,6 +473,8 @@ if (cfile) { printc("\t\tpanic(\"%s: vop_vector %p already registered\",") printc("\t\t __func__, orig_vop);"); printc(""); + printc("\tcache_vop_vector_register(orig_vop);"); + printc(""); for (name in funcarr) { printc("\tvop = orig_vop;"); printc("\twhile (vop != NULL && \\"); |
