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

Function cache_fplookup_degenerate

freebsd/kern/vfs_cache.c:4513–4567  ·  view source on GitHub ↗

* Comment from locked lookup: * Check for degenerate name (e.g. / or "") which is a way of talking about a * directory, e.g. like "/." or ".". */

Source from the content-addressed store, hash-verified

4511 * directory, e.g. like "/." or ".".
4512 */
4513static int __noinline
4514cache_fplookup_degenerate(struct cache_fpl *fpl)
4515{
4516 struct componentname *cnp;
4517 struct vnode *dvp;
4518 enum vgetstate dvs;
4519 int error, lkflags;
4520#ifdef INVARIANTS
4521 char *cp;
4522#endif
4523
4524 fpl->tvp = fpl->dvp;
4525 fpl->tvp_seqc = fpl->dvp_seqc;
4526
4527 cnp = fpl->cnp;
4528 dvp = fpl->dvp;
4529
4530#ifdef INVARIANTS
4531 for (cp = cnp->cn_pnbuf; *cp != '\0'; cp++) {
4532 KASSERT(*cp == '/',
4533 ("%s: encountered non-slash; string [%s]\n", __func__,
4534 cnp->cn_pnbuf));
4535 }
4536#endif
4537
4538 if (__predict_false(cnp->cn_nameiop != LOOKUP)) {
4539 cache_fpl_smr_exit(fpl);
4540 return (cache_fpl_handled_error(fpl, EISDIR));
4541 }
4542
4543 MPASS((cnp->cn_flags & SAVESTART) == 0);
4544
4545 if ((cnp->cn_flags & (LOCKPARENT|WANTPARENT)) != 0) {
4546 return (cache_fplookup_final_withparent(fpl));
4547 }
4548
4549 dvs = vget_prep_smr(dvp);
4550 cache_fpl_smr_exit(fpl);
4551 if (__predict_false(dvs == VGET_NONE)) {
4552 return (cache_fpl_aborted(fpl));
4553 }
4554
4555 if ((cnp->cn_flags & LOCKLEAF) != 0) {
4556 lkflags = LK_SHARED;
4557 if ((cnp->cn_flags & LOCKSHARED) == 0)
4558 lkflags = LK_EXCLUSIVE;
4559 error = vget_finish(dvp, lkflags, dvs);
4560 if (__predict_false(error != 0)) {
4561 return (cache_fpl_aborted(fpl));
4562 }
4563 } else {
4564 vget_finish_ref(dvp, dvs);
4565 }
4566 return (cache_fpl_handled(fpl));
4567}
4568
4569static int __noinline
4570cache_fplookup_noentry(struct cache_fpl *fpl)

Callers 2

cache_fplookup_noentryFunction · 0.85

Calls 4

vget_prep_smrFunction · 0.85
vget_finishFunction · 0.85
vget_finish_refFunction · 0.85

Tested by

no test coverage detected