Lines Matching defs:fpl
4220 static bool cache_fplookup_is_mp(struct cache_fpl *fpl);
4221 static int cache_fplookup_cross_mount(struct cache_fpl *fpl);
4222 static int cache_fplookup_partial_setup(struct cache_fpl *fpl);
4223 static int cache_fplookup_skip_slashes(struct cache_fpl *fpl);
4224 static int cache_fplookup_trailingslash(struct cache_fpl *fpl);
4225 static void cache_fpl_pathlen_dec(struct cache_fpl *fpl);
4226 static void cache_fpl_pathlen_inc(struct cache_fpl *fpl);
4227 static void cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n);
4228 static void cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n);
4240 cache_fpl_handle_root(struct cache_fpl *fpl)
4245 ndp = fpl->ndp;
4246 cnp = fpl->cnp;
4250 cache_fpl_pathlen_dec(fpl);
4255 cache_fpl_pathlen_dec(fpl);
4263 cache_fpl_checkpoint_outer(struct cache_fpl *fpl)
4266 fpl->snd_outer.ni_pathlen = fpl->ndp->ni_pathlen;
4267 fpl->snd_outer.cn_flags = fpl->ndp->ni_cnd.cn_flags;
4271 cache_fpl_checkpoint(struct cache_fpl *fpl)
4275 fpl->snd.cn_nameptr = fpl->ndp->ni_cnd.cn_nameptr;
4276 fpl->snd.ni_pathlen = fpl->debug.ni_pathlen;
4281 cache_fpl_restore_partial(struct cache_fpl *fpl)
4284 fpl->ndp->ni_cnd.cn_flags = fpl->snd_outer.cn_flags;
4286 fpl->debug.ni_pathlen = fpl->snd.ni_pathlen;
4291 cache_fpl_restore_abort(struct cache_fpl *fpl)
4294 cache_fpl_restore_partial(fpl);
4298 fpl->ndp->ni_resflags = 0;
4299 fpl->ndp->ni_cnd.cn_nameptr = fpl->ndp->ni_cnd.cn_pnbuf;
4300 fpl->ndp->ni_pathlen = fpl->snd_outer.ni_pathlen;
4304 #define cache_fpl_smr_assert_entered(fpl) ({ \
4305 struct cache_fpl *_fpl = (fpl); \
4309 #define cache_fpl_smr_assert_not_entered(fpl) ({ \
4310 struct cache_fpl *_fpl = (fpl); \
4315 cache_fpl_assert_status(struct cache_fpl *fpl)
4318 switch (fpl->status) {
4330 #define cache_fpl_smr_assert_entered(fpl) do { } while (0)
4331 #define cache_fpl_smr_assert_not_entered(fpl) do { } while (0)
4332 #define cache_fpl_assert_status(fpl) do { } while (0)
4335 #define cache_fpl_smr_enter_initial(fpl) ({ \
4336 struct cache_fpl *_fpl = (fpl); \
4341 #define cache_fpl_smr_enter(fpl) ({ \
4342 struct cache_fpl *_fpl = (fpl); \
4348 #define cache_fpl_smr_exit(fpl) ({ \
4349 struct cache_fpl *_fpl = (fpl); \
4356 cache_fpl_aborted_early_impl(struct cache_fpl *fpl, int line)
4359 if (fpl->status != CACHE_FPL_STATUS_UNSET) {
4360 KASSERT(fpl->status == CACHE_FPL_STATUS_PARTIAL,
4362 __func__, fpl->status, line, fpl->line));
4364 cache_fpl_smr_assert_not_entered(fpl);
4365 fpl->status = CACHE_FPL_STATUS_ABORTED;
4366 fpl->line = line;
4373 cache_fpl_aborted_impl(struct cache_fpl *fpl, int line)
4378 ndp = fpl->ndp;
4379 cnp = fpl->cnp;
4381 if (fpl->status != CACHE_FPL_STATUS_UNSET) {
4382 KASSERT(fpl->status == CACHE_FPL_STATUS_PARTIAL,
4384 __func__, fpl->status, line, fpl->line));
4386 fpl->status = CACHE_FPL_STATUS_ABORTED;
4387 fpl->line = line;
4388 if (fpl->in_smr)
4389 cache_fpl_smr_exit(fpl);
4390 cache_fpl_restore_abort(fpl);
4396 fpl->status = CACHE_FPL_STATUS_DESTROYED;
4405 cache_fpl_partial_impl(struct cache_fpl *fpl, int line)
4408 KASSERT(fpl->status == CACHE_FPL_STATUS_UNSET,
4410 __func__, line, fpl->status, fpl->line));
4411 cache_fpl_smr_assert_entered(fpl);
4412 fpl->status = CACHE_FPL_STATUS_PARTIAL;
4413 fpl->line = line;
4414 return (cache_fplookup_partial_setup(fpl));
4420 cache_fpl_handled_impl(struct cache_fpl *fpl, int line)
4423 KASSERT(fpl->status == CACHE_FPL_STATUS_UNSET,
4425 __func__, line, fpl->status, fpl->line));
4426 cache_fpl_smr_assert_not_entered(fpl);
4427 fpl->status = CACHE_FPL_STATUS_HANDLED;
4428 fpl->line = line;
4435 cache_fpl_handled_error_impl(struct cache_fpl *fpl, int error, int line)
4438 KASSERT(fpl->status == CACHE_FPL_STATUS_UNSET,
4440 __func__, line, fpl->status, fpl->line));
4443 cache_fpl_smr_assert_not_entered(fpl);
4444 fpl->status = CACHE_FPL_STATUS_HANDLED;
4445 fpl->line = line;
4446 fpl->dvp = NULL;
4447 fpl->tvp = NULL;
4454 cache_fpl_terminated(struct cache_fpl *fpl)
4457 return (fpl->status != CACHE_FPL_STATUS_UNSET);
4480 cache_fpl_istrailingslash(struct cache_fpl *fpl)
4483 MPASS(fpl->nulchar > fpl->cnp->cn_pnbuf);
4484 return (*(fpl->nulchar - 1) == '/');
4498 cache_can_fplookup(struct cache_fpl *fpl)
4504 ndp = fpl->ndp;
4505 cnp = fpl->cnp;
4509 cache_fpl_aborted_early(fpl);
4513 cache_fpl_aborted_early(fpl);
4517 cache_fpl_aborted_early(fpl);
4521 cache_fpl_aborted_early(fpl);
4525 cache_fpl_aborted_early(fpl);
4532 cache_fplookup_dirfd(struct cache_fpl *fpl, struct vnode **vpp)
4539 ndp = fpl->ndp;
4540 cnp = fpl->cnp;
4544 return (cache_fpl_aborted(fpl));
4546 fpl->fsearch = fsearch;
4549 cache_fpl_smr_exit(fpl);
4550 return (cache_fpl_handled_error(fpl, ENOTDIR));
4557 cache_fplookup_negative_promote(struct cache_fpl *fpl, struct namecache *oncp,
4563 cnp = fpl->cnp;
4564 dvp = fpl->dvp;
4566 cache_fpl_smr_exit(fpl);
4568 return (cache_fpl_handled_error(fpl, ENOENT));
4570 return (cache_fpl_aborted(fpl));
4577 cache_fplookup_partial_setup(struct cache_fpl *fpl)
4586 ndp = fpl->ndp;
4587 cnp = fpl->cnp;
4588 pwd = *(fpl->pwd);
4589 dvp = fpl->dvp;
4590 dvp_seqc = fpl->dvp_seqc;
4593 return (cache_fpl_aborted(fpl));
4607 cache_fpl_smr_exit(fpl);
4610 return (cache_fpl_aborted(fpl));
4617 return (cache_fpl_aborted(fpl));
4620 cache_fpl_restore_partial(fpl);
4622 if (cnp->cn_nameptr != fpl->snd.cn_nameptr) {
4624 cnp->cn_nameptr, fpl->snd.cn_nameptr, cnp->cn_pnbuf);
4642 cache_fpl_pathlen_dec(fpl);
4646 ndp->ni_pathlen = fpl->nulchar - cnp->cn_nameptr + 1;
4648 if (ndp->ni_pathlen != fpl->debug.ni_pathlen) {
4650 __func__, ndp->ni_pathlen, fpl->debug.ni_pathlen, fpl->nulchar,
4658 cache_fplookup_final_child(struct cache_fpl *fpl, enum vgetstate tvs)
4665 cnp = fpl->cnp;
4666 tvp = fpl->tvp;
4667 tvp_seqc = fpl->tvp_seqc;
4675 return (cache_fpl_aborted(fpl));
4686 return (cache_fpl_aborted(fpl));
4689 return (cache_fpl_handled(fpl));
4696 cache_fplookup_final_modifying(struct cache_fpl *fpl)
4707 ndp = fpl->ndp;
4708 cnp = fpl->cnp;
4709 dvp = fpl->dvp;
4710 dvp_seqc = fpl->dvp_seqc;
4731 if (cache_fpl_istrailingslash(fpl)) {
4732 return (cache_fpl_partial(fpl));
4737 return (cache_fpl_aborted(fpl));
4741 cache_fpl_smr_exit(fpl);
4747 return (cache_fpl_aborted(fpl));
4749 return (cache_fpl_handled_error(fpl, EROFS));
4752 if (fpl->tvp != NULL && (cnp->cn_flags & FAILIFEXISTS) != 0) {
4753 cache_fpl_smr_exit(fpl);
4754 return (cache_fpl_handled_error(fpl, EEXIST));
4772 cache_fpl_smr_exit(fpl);
4774 return (cache_fpl_aborted(fpl));
4780 return (cache_fpl_aborted(fpl));
4786 return (cache_fpl_aborted(fpl));
4804 return (cache_fpl_handled_error(fpl, error));
4807 return (cache_fpl_aborted(fpl));
4810 fpl->tvp = tvp;
4817 return (cache_fpl_handled(fpl));
4830 return (cache_fpl_aborted(fpl));
4841 return (cache_fpl_aborted(fpl));
4849 if (__predict_false(cache_fplookup_is_mp(fpl))) {
4852 return (cache_fpl_aborted(fpl));
4858 return (cache_fpl_handled_error(fpl, EEXIST));
4869 return (cache_fpl_handled(fpl));
4873 cache_fplookup_modifying(struct cache_fpl *fpl)
4877 ndp = fpl->ndp;
4880 return (cache_fpl_partial(fpl));
4882 return (cache_fplookup_final_modifying(fpl));
4886 cache_fplookup_final_withparent(struct cache_fpl *fpl)
4894 cnp = fpl->cnp;
4895 dvp = fpl->dvp;
4896 dvp_seqc = fpl->dvp_seqc;
4897 tvp = fpl->tvp;
4906 return (cache_fpl_aborted(fpl));
4910 cache_fpl_smr_exit(fpl);
4912 return (cache_fpl_aborted(fpl));
4915 cache_fpl_smr_exit(fpl);
4921 return (cache_fpl_aborted(fpl));
4933 return (cache_fpl_aborted(fpl));
4936 error = cache_fplookup_final_child(fpl, tvs);
4938 MPASS(fpl->status == CACHE_FPL_STATUS_ABORTED ||
4939 fpl->status == CACHE_FPL_STATUS_DESTROYED);
4947 MPASS(fpl->status == CACHE_FPL_STATUS_HANDLED);
4952 cache_fplookup_final(struct cache_fpl *fpl)
4959 cnp = fpl->cnp;
4960 dvp = fpl->dvp;
4961 dvp_seqc = fpl->dvp_seqc;
4962 tvp = fpl->tvp;
4967 return (cache_fplookup_final_modifying(fpl));
4971 return (cache_fplookup_final_withparent(fpl));
4975 return (cache_fpl_partial(fpl));
4979 cache_fpl_smr_exit(fpl);
4981 return (cache_fpl_aborted(fpl));
4984 cache_fpl_smr_exit(fpl);
4985 return (cache_fplookup_final_child(fpl, tvs));
4994 cache_fplookup_degenerate(struct cache_fpl *fpl)
5004 fpl->tvp = fpl->dvp;
5005 fpl->tvp_seqc = fpl->dvp_seqc;
5007 cnp = fpl->cnp;
5008 dvp = fpl->dvp;
5019 cache_fpl_smr_exit(fpl);
5020 return (cache_fpl_handled_error(fpl, EISDIR));
5024 return (cache_fplookup_final_withparent(fpl));
5028 cache_fpl_smr_exit(fpl);
5030 return (cache_fpl_aborted(fpl));
5039 return (cache_fpl_aborted(fpl));
5044 return (cache_fpl_handled(fpl));
5048 cache_fplookup_emptypath(struct cache_fpl *fpl)
5056 fpl->tvp = fpl->dvp;
5057 fpl->tvp_seqc = fpl->dvp_seqc;
5059 ndp = fpl->ndp;
5060 cnp = fpl->cnp;
5061 tvp = fpl->tvp;
5066 cache_fpl_smr_exit(fpl);
5067 return (cache_fpl_handled_error(fpl, ENOENT));
5073 cache_fpl_smr_exit(fpl);
5075 return (cache_fpl_aborted(fpl));
5084 return (cache_fpl_aborted(fpl));
5091 return (cache_fpl_handled(fpl));
5095 cache_fplookup_noentry(struct cache_fpl *fpl)
5104 ndp = fpl->ndp;
5105 cnp = fpl->cnp;
5106 dvp = fpl->dvp;
5107 dvp_seqc = fpl->dvp_seqc;
5119 cache_fpl_smr_exit(fpl);
5120 return (cache_fpl_handled_error(fpl, ENAMETOOLONG));
5124 return (cache_fplookup_skip_slashes(fpl));
5128 return (cache_fplookup_emptypath(fpl));
5132 if (fpl->tvp == NULL) {
5133 return (cache_fplookup_degenerate(fpl));
5135 return (cache_fplookup_trailingslash(fpl));
5139 fpl->tvp = NULL;
5140 return (cache_fplookup_modifying(fpl));
5149 return (cache_fpl_partial(fpl));
5157 if (cache_fpl_istrailingslash(fpl)) {
5158 return (cache_fpl_partial(fpl));
5166 cache_fpl_smr_exit(fpl);
5168 return (cache_fpl_aborted(fpl));
5174 return (cache_fpl_aborted(fpl));
5180 return (cache_fpl_aborted(fpl));
5200 return (cache_fpl_handled_error(fpl, error));
5203 return (cache_fpl_aborted(fpl));
5206 fpl->tvp = tvp;
5215 return (cache_fpl_handled(fpl));
5222 return (cache_fpl_aborted(fpl));
5226 if (__predict_false(cache_fplookup_is_mp(fpl))) {
5229 return (cache_fpl_aborted(fpl));
5241 return (cache_fpl_handled(fpl));
5245 cache_fplookup_dot(struct cache_fpl *fpl)
5249 MPASS(!seqc_in_modify(fpl->dvp_seqc));
5251 if (__predict_false(fpl->dvp->v_type != VDIR)) {
5252 cache_fpl_smr_exit(fpl);
5253 return (cache_fpl_handled_error(fpl, ENOTDIR));
5261 fpl->tvp = fpl->dvp;
5262 fpl->tvp_seqc = fpl->dvp_seqc;
5264 SDT_PROBE3(vfs, namecache, lookup, hit, fpl->dvp, ".", fpl->dvp);
5267 if (cache_fplookup_is_mp(fpl)) {
5268 error = cache_fplookup_cross_mount(fpl);
5274 cache_fplookup_dotdot(struct cache_fpl *fpl)
5283 ndp = fpl->ndp;
5284 cnp = fpl->cnp;
5285 dvp = fpl->dvp;
5301 fpl->tvp = dvp;
5302 fpl->tvp_seqc = vn_seqc_read_any(dvp);
5303 if (seqc_in_modify(fpl->tvp_seqc)) {
5304 return (cache_fpl_aborted(fpl));
5314 return (cache_fpl_partial(fpl));
5318 cache_fpl_smr_exit(fpl);
5319 return (cache_fpl_handled_error(fpl, ENOTDIR));
5324 return (cache_fpl_aborted(fpl));
5330 return (cache_fpl_aborted(fpl));
5331 fpl->tvp = ncp->nc_vp;
5333 fpl->tvp = ncp->nc_dvp;
5336 fpl->tvp_seqc = vn_seqc_read_any(fpl->tvp);
5337 if (seqc_in_modify(fpl->tvp_seqc)) {
5338 return (cache_fpl_partial(fpl));
5345 return (cache_fpl_aborted(fpl));
5349 return (cache_fpl_aborted(fpl));
5356 cache_fplookup_neg(struct cache_fpl *fpl, struct namecache *ncp, uint32_t hash)
5368 if (__predict_false(fpl->cnp->cn_nameiop != LOOKUP)) {
5369 fpl->tvp = NULL;
5370 return (cache_fplookup_modifying(fpl));
5375 return (cache_fpl_partial(fpl));
5378 return (cache_fplookup_negative_promote(fpl, ncp, hash));
5381 cache_fpl_smr_exit(fpl);
5382 return (cache_fpl_handled_error(fpl, ENOENT));
5392 cache_symlink_resolve(struct cache_fpl *fpl, const char *string, size_t len)
5398 ndp = fpl->ndp;
5399 cnp = fpl->cnp;
5406 if (cache_fpl_istrailingslash(fpl)) {
5411 ndp->ni_pathlen = fpl->nulchar - cnp->cn_nameptr - cnp->cn_namelen + 1;
5413 if (ndp->ni_pathlen != fpl->debug.ni_pathlen) {
5415 __func__, ndp->ni_pathlen, fpl->debug.ni_pathlen, fpl->nulchar,
5432 if (cache_fpl_istrailingslash(fpl)) {
5443 cache_fpl_pathlen_add(fpl, adjust);
5445 fpl->nulchar = &cnp->cn_nameptr[ndp->ni_pathlen - 1];
5446 fpl->tvp = NULL;
5451 cache_fplookup_symlink(struct cache_fpl *fpl)
5460 ndp = fpl->ndp;
5461 cnp = fpl->cnp;
5462 dvp = fpl->dvp;
5463 tvp = fpl->tvp;
5464 pwd = *(fpl->pwd);
5468 return (cache_fplookup_final(fpl));
5474 return (cache_fpl_aborted(fpl));
5482 cache_fpl_smr_exit(fpl);
5483 return (cache_fpl_handled_error(fpl, EACCES));
5486 error = VOP_FPLOOKUP_SYMLINK(tvp, fpl);
5490 return (cache_fpl_partial(fpl));
5494 cache_fpl_smr_exit(fpl);
5495 return (cache_fpl_handled_error(fpl, error));
5497 return (cache_fpl_aborted(fpl));
5502 fpl->dvp = cache_fpl_handle_root(fpl);
5503 fpl->dvp_seqc = vn_seqc_read_any(fpl->dvp);
5504 if (seqc_in_modify(fpl->dvp_seqc)) {
5505 return (cache_fpl_aborted(fpl));
5512 mp = atomic_load_ptr(&fpl->dvp->v_mount);
5514 return (cache_fpl_aborted(fpl));
5517 cache_fpl_checkpoint(fpl);
5518 return (cache_fpl_partial(fpl));
5521 return (cache_fpl_aborted(fpl));
5528 cache_fplookup_next(struct cache_fpl *fpl)
5537 cnp = fpl->cnp;
5538 dvp = fpl->dvp;
5539 hash = fpl->hash;
5543 return (cache_fplookup_dot(fpl));
5546 return (cache_fplookup_dotdot(fpl));
5559 return (cache_fplookup_noentry(fpl));
5565 return (cache_fplookup_neg(fpl, ncp, hash));
5569 return (cache_fpl_partial(fpl));
5572 fpl->tvp = tvp;
5573 fpl->tvp_seqc = vn_seqc_read_any(tvp);
5574 if (seqc_in_modify(fpl->tvp_seqc)) {
5575 return (cache_fpl_partial(fpl));
5582 if (cache_fplookup_is_mp(fpl)) {
5583 error = cache_fplookup_cross_mount(fpl);
5617 cache_fplookup_climb_mount(struct cache_fpl *fpl)
5624 vp = fpl->tvp;
5625 vp_seqc = fpl->tvp_seqc;
5638 return (cache_fpl_partial(fpl));
5644 return (cache_fpl_partial(fpl));
5648 return (cache_fpl_partial(fpl));
5653 return (cache_fpl_partial(fpl));
5658 return (cache_fpl_partial(fpl));
5668 fpl->tvp = vp;
5669 fpl->tvp_seqc = vp_seqc;
5674 cache_fplookup_cross_mount(struct cache_fpl *fpl)
5681 vp = fpl->tvp;
5682 vp_seqc = fpl->tvp_seqc;
5691 return (cache_fpl_partial(fpl));
5695 return (cache_fpl_partial(fpl));
5699 return (cache_fpl_partial(fpl));
5704 return (cache_fpl_partial(fpl));
5709 return (cache_fpl_partial(fpl));
5718 return (cache_fplookup_climb_mount(fpl));
5721 fpl->tvp = vp;
5722 fpl->tvp_seqc = vp_seqc;
5730 cache_fplookup_is_mp(struct cache_fpl *fpl)
5734 vp = fpl->tvp;
5752 cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n)
5755 fpl->debug.ni_pathlen += n;
5756 KASSERT(fpl->debug.ni_pathlen <= PATH_MAX,
5757 ("%s: pathlen overflow to %zd\n", __func__, fpl->debug.ni_pathlen));
5761 cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n)
5764 fpl->debug.ni_pathlen -= n;
5765 KASSERT(fpl->debug.ni_pathlen <= PATH_MAX,
5766 ("%s: pathlen underflow to %zd\n", __func__, fpl->debug.ni_pathlen));
5770 cache_fpl_pathlen_inc(struct cache_fpl *fpl)
5773 cache_fpl_pathlen_add(fpl, 1);
5777 cache_fpl_pathlen_dec(struct cache_fpl *fpl)
5780 cache_fpl_pathlen_sub(fpl, 1);
5784 cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n)
5789 cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n)
5794 cache_fpl_pathlen_inc(struct cache_fpl *fpl)
5799 cache_fpl_pathlen_dec(struct cache_fpl *fpl)
5805 cache_fplookup_parse(struct cache_fpl *fpl)
5813 ndp = fpl->ndp;
5814 cnp = fpl->cnp;
5815 dvp = fpl->dvp;
5826 MPASS(&cnp->cn_nameptr[fpl->debug.ni_pathlen - 1] >= cnp->cn_pnbuf);
5827 KASSERT(&cnp->cn_nameptr[fpl->debug.ni_pathlen - 1] == fpl->nulchar,
5829 __func__, fpl->debug.ni_pathlen, &cnp->cn_nameptr[fpl->debug.ni_pathlen - 1],
5830 fpl->nulchar, cnp->cn_pnbuf));
5831 KASSERT(*fpl->nulchar == '\0',
5832 ("%s: expected nul at %p; string [%s]\n", __func__, fpl->nulchar,
5835 *fpl->nulchar = '/';
5843 *fpl->nulchar = '\0';
5844 fpl->hash = cache_get_hash_iter_finish(hash);
5847 cache_fpl_pathlen_sub(fpl, cnp->cn_namelen);
5855 if (fpl->hash != cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp)) {
5872 cache_fplookup_parse_advance(struct cache_fpl *fpl)
5877 ndp = fpl->ndp;
5878 cnp = fpl->cnp;
5885 cache_fpl_pathlen_dec(fpl);
5898 cache_fplookup_skip_slashes(struct cache_fpl *fpl)
5903 ndp = fpl->ndp;
5904 cnp = fpl->cnp;
5909 cache_fpl_pathlen_dec(fpl);
5917 cache_fpl_pathlen_inc(fpl);
5927 fpl->tvp = fpl->dvp;
5928 fpl->tvp_seqc = fpl->dvp_seqc;
5951 cache_fplookup_trailingslash(struct cache_fpl *fpl)
5964 ndp = fpl->ndp;
5965 cnp = fpl->cnp;
5966 tvp = fpl->tvp;
5967 tvp_seqc = fpl->tvp_seqc;
5969 MPASS(fpl->dvp == fpl->tvp);
5970 KASSERT(cache_fpl_istrailingslash(fpl),
5971 ("%s: expected trailing slash at %p; string [%s]\n", __func__, fpl->nulchar - 1,
5982 return (cache_fpl_aborted(fpl));
5987 return (cache_fpl_aborted(fpl));
5989 cache_fpl_smr_exit(fpl);
5990 return (cache_fpl_handled_error(fpl, ENOTDIR));
6027 cache_fpl_pathlen_add(fpl, cn_nameptr_orig - cnp->cn_nameptr);
6028 cache_fpl_checkpoint(fpl);
6031 ni_pathlen = fpl->nulchar - cnp->cn_nameptr + 1;
6032 if (ni_pathlen != fpl->debug.ni_pathlen) {
6034 __func__, ni_pathlen, fpl->debug.ni_pathlen, fpl->nulchar,
6049 tvp = fpl->tvp;
6052 return (cache_fpl_aborted(fpl));
6056 return (cache_fpl_aborted(fpl));
6058 fpl->dvp = ncp->nc_dvp;
6059 fpl->dvp_seqc = vn_seqc_read_any(fpl->dvp);
6060 if (seqc_in_modify(fpl->dvp_seqc)) {
6061 return (cache_fpl_aborted(fpl));
6070 cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error)
6076 cnp = fpl->cnp;
6077 dvp = fpl->dvp;
6078 dvp_seqc = fpl->dvp_seqc;
6084 return (cache_fplookup_emptypath(fpl));
6094 if (cache_fpl_istrailingslash(fpl)) {
6095 return (cache_fpl_aborted(fpl));
6101 if (cnp->cn_nameptr[0] == '\0' && fpl->tvp == NULL) {
6102 return (cache_fplookup_degenerate(fpl));
6109 cache_fpl_smr_exit(fpl);
6110 return (cache_fpl_handled_error(fpl, ENAMETOOLONG));
6146 if (fpl->fsearch) {
6147 return (cache_fpl_aborted(fpl));
6153 error = cache_fpl_aborted(fpl);
6155 cache_fpl_partial(fpl);
6160 error = cache_fpl_aborted(fpl);
6162 cache_fpl_smr_exit(fpl);
6163 cache_fpl_handled_error(fpl, error);
6171 cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl)
6178 ndp = fpl->ndp;
6179 cnp = fpl->cnp;
6181 cache_fpl_checkpoint(fpl);
6188 fpl->dvp = dvp;
6189 fpl->dvp_seqc = vn_seqc_read_notmodify(fpl->dvp);
6193 return (cache_fpl_aborted(fpl));
6196 MPASS(fpl->tvp == NULL);
6199 cache_fplookup_parse(fpl);
6201 error = VOP_FPLOOKUP_VEXEC(fpl->dvp, cnp->cn_cred);
6203 error = cache_fplookup_failed_vexec(fpl, error);
6207 error = cache_fplookup_next(fpl);
6208 if (__predict_false(cache_fpl_terminated(fpl))) {
6212 VNPASS(!seqc_in_modify(fpl->tvp_seqc), fpl->tvp);
6214 if (fpl->tvp->v_type == VLNK) {
6215 error = cache_fplookup_symlink(fpl);
6216 if (cache_fpl_terminated(fpl)) {
6221 error = cache_fplookup_final(fpl);
6225 if (!vn_seqc_consistent(fpl->dvp, fpl->dvp_seqc)) {
6226 error = cache_fpl_aborted(fpl);
6230 fpl->dvp = fpl->tvp;
6231 fpl->dvp_seqc = fpl->tvp_seqc;
6232 cache_fplookup_parse_advance(fpl);
6235 cache_fpl_checkpoint(fpl);
6321 struct cache_fpl fpl;
6327 fpl.status = CACHE_FPL_STATUS_UNSET;
6328 fpl.in_smr = false;
6329 fpl.ndp = ndp;
6330 fpl.cnp = cnp = &ndp->ni_cnd;
6338 if (__predict_false(!cache_can_fplookup(&fpl))) {
6339 *status = fpl.status;
6340 SDT_PROBE3(vfs, fplookup, lookup, done, ndp, fpl.line, fpl.status);
6344 cache_fpl_checkpoint_outer(&fpl);
6346 cache_fpl_smr_enter_initial(&fpl);
6348 fpl.debug.ni_pathlen = ndp->ni_pathlen;
6350 fpl.nulchar = &cnp->cn_nameptr[ndp->ni_pathlen - 1];
6351 fpl.fsearch = false;
6352 fpl.tvp = NULL; /* for degenerate path handling */
6353 fpl.pwd = pwdp;
6355 *(fpl.pwd) = pwd;
6360 dvp = cache_fpl_handle_root(&fpl);
6366 error = cache_fplookup_dirfd(&fpl, &dvp);
6374 error = cache_fplookup_impl(dvp, &fpl);
6376 cache_fpl_smr_assert_not_entered(&fpl);
6377 cache_fpl_assert_status(&fpl);
6378 *status = fpl.status;
6380 SDT_PROBE3(vfs, fplookup, lookup, done, ndp, fpl.line, fpl.status);
6381 if (fpl.status == CACHE_FPL_STATUS_HANDLED)
6386 if (__predict_true(fpl.status == CACHE_FPL_STATUS_HANDLED)) {
6389 cache_fpl_cleanup_cnp(fpl.cnp);
6390 MPASS(fpl.dvp == NULL);
6391 MPASS(fpl.tvp == NULL);
6393 ndp->ni_dvp = fpl.dvp;
6394 ndp->ni_vp = fpl.tvp;