MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cache_validate

Function cache_validate

freebsd/kern/vfs_cache.c:2789–2811  ·  view source on GitHub ↗

* Validate that if an entry exists it matches. */

Source from the content-addressed store, hash-verified

2787 * Validate that if an entry exists it matches.
2788 */
2789void
2790cache_validate(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
2791{
2792 struct namecache *ncp;
2793 struct mtx *blp;
2794 uint32_t hash;
2795
2796 hash = cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp);
2797 if (CK_SLIST_EMPTY(NCHHASH(hash)))
2798 return;
2799 blp = HASH2BUCKETLOCK(hash);
2800 mtx_lock(blp);
2801 CK_SLIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) {
2802 if (ncp->nc_dvp == dvp && ncp->nc_nlen == cnp->cn_namelen &&
2803 !bcmp(ncp->nc_name, cnp->cn_nameptr, ncp->nc_nlen)) {
2804 if (ncp->nc_vp != vp)
2805 panic("%s: mismatch (%p != %p); ncp %p [%s] dvp %p vp %p\n",
2806 __func__, vp, ncp->nc_vp, ncp, ncp->nc_name, ncp->nc_dvp,
2807 ncp->nc_vp);
2808 }
2809 }
2810 mtx_unlock(blp);
2811}
2812#endif
2813
2814/*

Callers 1

vop_mkdir_debugpostFunction · 0.70

Calls 4

cache_get_hashFunction · 0.85
mtx_lockFunction · 0.70
panicFunction · 0.70
mtx_unlockFunction · 0.70

Tested by

no test coverage detected