Lines Matching refs:fpl

4275 static bool cache_fplookup_is_mp(struct cache_fpl *fpl);
4276 static int cache_fplookup_cross_mount(struct cache_fpl *fpl);
4277 static int cache_fplookup_partial_setup(struct cache_fpl *fpl);
4278 static int cache_fplookup_skip_slashes(struct cache_fpl *fpl);
4279 static int cache_fplookup_trailingslash(struct cache_fpl *fpl);
4280 static void cache_fpl_pathlen_dec(struct cache_fpl *fpl);
4281 static void cache_fpl_pathlen_inc(struct cache_fpl *fpl);
4282 static void cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n);
4283 static void cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n);
4295 cache_fpl_handle_root(struct cache_fpl *fpl) in cache_fpl_handle_root() argument
4300 ndp = fpl->ndp; in cache_fpl_handle_root()
4301 cnp = fpl->cnp; in cache_fpl_handle_root()
4305 cache_fpl_pathlen_dec(fpl); in cache_fpl_handle_root()
4310 cache_fpl_pathlen_dec(fpl); in cache_fpl_handle_root()
4318 cache_fpl_checkpoint_outer(struct cache_fpl *fpl) in cache_fpl_checkpoint_outer() argument
4321 fpl->snd_outer.ni_pathlen = fpl->ndp->ni_pathlen; in cache_fpl_checkpoint_outer()
4322 fpl->snd_outer.cn_flags = fpl->ndp->ni_cnd.cn_flags; in cache_fpl_checkpoint_outer()
4326 cache_fpl_checkpoint(struct cache_fpl *fpl) in cache_fpl_checkpoint() argument
4330 fpl->snd.cn_nameptr = fpl->ndp->ni_cnd.cn_nameptr; in cache_fpl_checkpoint()
4331 fpl->snd.ni_pathlen = fpl->debug.ni_pathlen; in cache_fpl_checkpoint()
4336 cache_fpl_restore_partial(struct cache_fpl *fpl) in cache_fpl_restore_partial() argument
4339 fpl->ndp->ni_cnd.cn_flags = fpl->snd_outer.cn_flags; in cache_fpl_restore_partial()
4341 fpl->debug.ni_pathlen = fpl->snd.ni_pathlen; in cache_fpl_restore_partial()
4346 cache_fpl_restore_abort(struct cache_fpl *fpl) in cache_fpl_restore_abort() argument
4349 cache_fpl_restore_partial(fpl); in cache_fpl_restore_abort()
4353 fpl->ndp->ni_resflags = 0; in cache_fpl_restore_abort()
4354 fpl->ndp->ni_cnd.cn_nameptr = fpl->ndp->ni_cnd.cn_pnbuf; in cache_fpl_restore_abort()
4355 fpl->ndp->ni_pathlen = fpl->snd_outer.ni_pathlen; in cache_fpl_restore_abort()
4359 #define cache_fpl_smr_assert_entered(fpl) ({ \ argument
4360 struct cache_fpl *_fpl = (fpl); \
4364 #define cache_fpl_smr_assert_not_entered(fpl) ({ \ argument
4365 struct cache_fpl *_fpl = (fpl); \
4370 cache_fpl_assert_status(struct cache_fpl *fpl) in cache_fpl_assert_status() argument
4373 switch (fpl->status) { in cache_fpl_assert_status()
4385 #define cache_fpl_smr_assert_entered(fpl) do { } while (0) argument
4386 #define cache_fpl_smr_assert_not_entered(fpl) do { } while (0) argument
4387 #define cache_fpl_assert_status(fpl) do { } while (0) argument
4390 #define cache_fpl_smr_enter_initial(fpl) ({ \ argument
4391 struct cache_fpl *_fpl = (fpl); \
4396 #define cache_fpl_smr_enter(fpl) ({ \ argument
4397 struct cache_fpl *_fpl = (fpl); \
4403 #define cache_fpl_smr_exit(fpl) ({ \ argument
4404 struct cache_fpl *_fpl = (fpl); \
4411 cache_fpl_aborted_early_impl(struct cache_fpl *fpl, int line) in cache_fpl_aborted_early_impl() argument
4414 if (fpl->status != CACHE_FPL_STATUS_UNSET) { in cache_fpl_aborted_early_impl()
4415 KASSERT(fpl->status == CACHE_FPL_STATUS_PARTIAL, in cache_fpl_aborted_early_impl()
4417 __func__, fpl->status, line, fpl->line)); in cache_fpl_aborted_early_impl()
4419 cache_fpl_smr_assert_not_entered(fpl); in cache_fpl_aborted_early_impl()
4420 fpl->status = CACHE_FPL_STATUS_ABORTED; in cache_fpl_aborted_early_impl()
4421 fpl->line = line; in cache_fpl_aborted_early_impl()
4428 cache_fpl_aborted_impl(struct cache_fpl *fpl, int line) in cache_fpl_aborted_impl() argument
4433 ndp = fpl->ndp; in cache_fpl_aborted_impl()
4434 cnp = fpl->cnp; in cache_fpl_aborted_impl()
4436 if (fpl->status != CACHE_FPL_STATUS_UNSET) { in cache_fpl_aborted_impl()
4437 KASSERT(fpl->status == CACHE_FPL_STATUS_PARTIAL, in cache_fpl_aborted_impl()
4439 __func__, fpl->status, line, fpl->line)); in cache_fpl_aborted_impl()
4441 fpl->status = CACHE_FPL_STATUS_ABORTED; in cache_fpl_aborted_impl()
4442 fpl->line = line; in cache_fpl_aborted_impl()
4443 if (fpl->in_smr) in cache_fpl_aborted_impl()
4444 cache_fpl_smr_exit(fpl); in cache_fpl_aborted_impl()
4445 cache_fpl_restore_abort(fpl); in cache_fpl_aborted_impl()
4451 fpl->status = CACHE_FPL_STATUS_DESTROYED; in cache_fpl_aborted_impl()
4460 cache_fpl_partial_impl(struct cache_fpl *fpl, int line) in cache_fpl_partial_impl() argument
4463 KASSERT(fpl->status == CACHE_FPL_STATUS_UNSET, in cache_fpl_partial_impl()
4465 __func__, line, fpl->status, fpl->line)); in cache_fpl_partial_impl()
4466 cache_fpl_smr_assert_entered(fpl); in cache_fpl_partial_impl()
4467 fpl->status = CACHE_FPL_STATUS_PARTIAL; in cache_fpl_partial_impl()
4468 fpl->line = line; in cache_fpl_partial_impl()
4469 return (cache_fplookup_partial_setup(fpl)); in cache_fpl_partial_impl()
4475 cache_fpl_handled_impl(struct cache_fpl *fpl, int line) in cache_fpl_handled_impl() argument
4478 KASSERT(fpl->status == CACHE_FPL_STATUS_UNSET, in cache_fpl_handled_impl()
4480 __func__, line, fpl->status, fpl->line)); in cache_fpl_handled_impl()
4481 cache_fpl_smr_assert_not_entered(fpl); in cache_fpl_handled_impl()
4482 fpl->status = CACHE_FPL_STATUS_HANDLED; in cache_fpl_handled_impl()
4483 fpl->line = line; in cache_fpl_handled_impl()
4490 cache_fpl_handled_error_impl(struct cache_fpl *fpl, int error, int line) in cache_fpl_handled_error_impl() argument
4493 KASSERT(fpl->status == CACHE_FPL_STATUS_UNSET, in cache_fpl_handled_error_impl()
4495 __func__, line, fpl->status, fpl->line)); in cache_fpl_handled_error_impl()
4498 cache_fpl_smr_assert_not_entered(fpl); in cache_fpl_handled_error_impl()
4499 fpl->status = CACHE_FPL_STATUS_HANDLED; in cache_fpl_handled_error_impl()
4500 fpl->line = line; in cache_fpl_handled_error_impl()
4501 fpl->dvp = NULL; in cache_fpl_handled_error_impl()
4502 fpl->tvp = NULL; in cache_fpl_handled_error_impl()
4509 cache_fpl_terminated(struct cache_fpl *fpl) in cache_fpl_terminated() argument
4512 return (fpl->status != CACHE_FPL_STATUS_UNSET); in cache_fpl_terminated()
4535 cache_fpl_istrailingslash(struct cache_fpl *fpl) in cache_fpl_istrailingslash() argument
4538 MPASS(fpl->nulchar > fpl->cnp->cn_pnbuf); in cache_fpl_istrailingslash()
4539 return (*(fpl->nulchar - 1) == '/'); in cache_fpl_istrailingslash()
4553 cache_can_fplookup(struct cache_fpl *fpl) in cache_can_fplookup() argument
4559 ndp = fpl->ndp; in cache_can_fplookup()
4560 cnp = fpl->cnp; in cache_can_fplookup()
4564 cache_fpl_aborted_early(fpl); in cache_can_fplookup()
4568 cache_fpl_aborted_early(fpl); in cache_can_fplookup()
4572 cache_fpl_aborted_early(fpl); in cache_can_fplookup()
4576 cache_fpl_aborted_early(fpl); in cache_can_fplookup()
4580 cache_fpl_aborted_early(fpl); in cache_can_fplookup()
4587 cache_fplookup_dirfd(struct cache_fpl *fpl, struct vnode **vpp) in cache_fplookup_dirfd() argument
4593 ndp = fpl->ndp; in cache_fplookup_dirfd()
4594 cnp = fpl->cnp; in cache_fplookup_dirfd()
4598 return (cache_fpl_aborted(fpl)); in cache_fplookup_dirfd()
4603 cache_fpl_smr_exit(fpl); in cache_fplookup_dirfd()
4604 cache_fpl_aborted(fpl); in cache_fplookup_dirfd()
4607 fpl->fsearch = (flags & FSEARCH) != 0; in cache_fplookup_dirfd()
4610 cache_fpl_smr_exit(fpl); in cache_fplookup_dirfd()
4611 return (cache_fpl_handled_error(fpl, ENOTDIR)); in cache_fplookup_dirfd()
4618 cache_fplookup_negative_promote(struct cache_fpl *fpl, struct namecache *oncp, in cache_fplookup_negative_promote() argument
4624 cnp = fpl->cnp; in cache_fplookup_negative_promote()
4625 dvp = fpl->dvp; in cache_fplookup_negative_promote()
4627 cache_fpl_smr_exit(fpl); in cache_fplookup_negative_promote()
4629 return (cache_fpl_handled_error(fpl, ENOENT)); in cache_fplookup_negative_promote()
4631 return (cache_fpl_aborted(fpl)); in cache_fplookup_negative_promote()
4638 cache_fplookup_partial_setup(struct cache_fpl *fpl) in cache_fplookup_partial_setup() argument
4647 ndp = fpl->ndp; in cache_fplookup_partial_setup()
4648 cnp = fpl->cnp; in cache_fplookup_partial_setup()
4649 pwd = *(fpl->pwd); in cache_fplookup_partial_setup()
4650 dvp = fpl->dvp; in cache_fplookup_partial_setup()
4651 dvp_seqc = fpl->dvp_seqc; in cache_fplookup_partial_setup()
4654 return (cache_fpl_aborted(fpl)); in cache_fplookup_partial_setup()
4668 cache_fpl_smr_exit(fpl); in cache_fplookup_partial_setup()
4671 return (cache_fpl_aborted(fpl)); in cache_fplookup_partial_setup()
4678 return (cache_fpl_aborted(fpl)); in cache_fplookup_partial_setup()
4681 cache_fpl_restore_partial(fpl); in cache_fplookup_partial_setup()
4683 if (cnp->cn_nameptr != fpl->snd.cn_nameptr) { in cache_fplookup_partial_setup()
4685 cnp->cn_nameptr, fpl->snd.cn_nameptr, cnp->cn_pnbuf); in cache_fplookup_partial_setup()
4703 cache_fpl_pathlen_dec(fpl); in cache_fplookup_partial_setup()
4707 ndp->ni_pathlen = fpl->nulchar - cnp->cn_nameptr + 1; in cache_fplookup_partial_setup()
4709 if (ndp->ni_pathlen != fpl->debug.ni_pathlen) { in cache_fplookup_partial_setup()
4711 __func__, ndp->ni_pathlen, fpl->debug.ni_pathlen, fpl->nulchar, in cache_fplookup_partial_setup()
4719 cache_fplookup_final_child(struct cache_fpl *fpl, enum vgetstate tvs) in cache_fplookup_final_child() argument
4726 cnp = fpl->cnp; in cache_fplookup_final_child()
4727 tvp = fpl->tvp; in cache_fplookup_final_child()
4728 tvp_seqc = fpl->tvp_seqc; in cache_fplookup_final_child()
4736 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_child()
4747 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_child()
4750 return (cache_fpl_handled(fpl)); in cache_fplookup_final_child()
4757 cache_fplookup_final_modifying(struct cache_fpl *fpl) in cache_fplookup_final_modifying() argument
4768 ndp = fpl->ndp; in cache_fplookup_final_modifying()
4769 cnp = fpl->cnp; in cache_fplookup_final_modifying()
4770 dvp = fpl->dvp; in cache_fplookup_final_modifying()
4771 dvp_seqc = fpl->dvp_seqc; in cache_fplookup_final_modifying()
4792 if (cache_fpl_istrailingslash(fpl)) { in cache_fplookup_final_modifying()
4793 return (cache_fpl_partial(fpl)); in cache_fplookup_final_modifying()
4798 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4802 cache_fpl_smr_exit(fpl); in cache_fplookup_final_modifying()
4808 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4810 return (cache_fpl_handled_error(fpl, EROFS)); in cache_fplookup_final_modifying()
4813 if (fpl->tvp != NULL && (cnp->cn_flags & FAILIFEXISTS) != 0) { in cache_fplookup_final_modifying()
4814 cache_fpl_smr_exit(fpl); in cache_fplookup_final_modifying()
4815 return (cache_fpl_handled_error(fpl, EEXIST)); in cache_fplookup_final_modifying()
4833 cache_fpl_smr_exit(fpl); in cache_fplookup_final_modifying()
4835 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4841 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4847 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4865 return (cache_fpl_handled_error(fpl, error)); in cache_fplookup_final_modifying()
4868 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4871 fpl->tvp = tvp; in cache_fplookup_final_modifying()
4878 return (cache_fpl_handled(fpl)); in cache_fplookup_final_modifying()
4891 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4902 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4910 if (__predict_false(cache_fplookup_is_mp(fpl))) { in cache_fplookup_final_modifying()
4913 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4919 return (cache_fpl_handled_error(fpl, EEXIST)); in cache_fplookup_final_modifying()
4930 return (cache_fpl_handled(fpl)); in cache_fplookup_final_modifying()
4934 cache_fplookup_modifying(struct cache_fpl *fpl) in cache_fplookup_modifying() argument
4938 ndp = fpl->ndp; in cache_fplookup_modifying()
4941 return (cache_fpl_partial(fpl)); in cache_fplookup_modifying()
4943 return (cache_fplookup_final_modifying(fpl)); in cache_fplookup_modifying()
4947 cache_fplookup_final_withparent(struct cache_fpl *fpl) in cache_fplookup_final_withparent() argument
4955 cnp = fpl->cnp; in cache_fplookup_final_withparent()
4956 dvp = fpl->dvp; in cache_fplookup_final_withparent()
4957 dvp_seqc = fpl->dvp_seqc; in cache_fplookup_final_withparent()
4958 tvp = fpl->tvp; in cache_fplookup_final_withparent()
4967 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_withparent()
4971 cache_fpl_smr_exit(fpl); in cache_fplookup_final_withparent()
4973 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_withparent()
4976 cache_fpl_smr_exit(fpl); in cache_fplookup_final_withparent()
4982 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_withparent()
4994 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_withparent()
4997 error = cache_fplookup_final_child(fpl, tvs); in cache_fplookup_final_withparent()
4999 MPASS(fpl->status == CACHE_FPL_STATUS_ABORTED || in cache_fplookup_final_withparent()
5000 fpl->status == CACHE_FPL_STATUS_DESTROYED); in cache_fplookup_final_withparent()
5008 MPASS(fpl->status == CACHE_FPL_STATUS_HANDLED); in cache_fplookup_final_withparent()
5013 cache_fplookup_final(struct cache_fpl *fpl) in cache_fplookup_final() argument
5020 cnp = fpl->cnp; in cache_fplookup_final()
5021 dvp = fpl->dvp; in cache_fplookup_final()
5022 dvp_seqc = fpl->dvp_seqc; in cache_fplookup_final()
5023 tvp = fpl->tvp; in cache_fplookup_final()
5028 return (cache_fplookup_final_modifying(fpl)); in cache_fplookup_final()
5032 return (cache_fplookup_final_withparent(fpl)); in cache_fplookup_final()
5036 return (cache_fpl_partial(fpl)); in cache_fplookup_final()
5040 cache_fpl_smr_exit(fpl); in cache_fplookup_final()
5042 return (cache_fpl_aborted(fpl)); in cache_fplookup_final()
5045 cache_fpl_smr_exit(fpl); in cache_fplookup_final()
5046 return (cache_fplookup_final_child(fpl, tvs)); in cache_fplookup_final()
5055 cache_fplookup_degenerate(struct cache_fpl *fpl) in cache_fplookup_degenerate() argument
5065 fpl->tvp = fpl->dvp; in cache_fplookup_degenerate()
5066 fpl->tvp_seqc = fpl->dvp_seqc; in cache_fplookup_degenerate()
5068 cnp = fpl->cnp; in cache_fplookup_degenerate()
5069 dvp = fpl->dvp; in cache_fplookup_degenerate()
5080 cache_fpl_smr_exit(fpl); in cache_fplookup_degenerate()
5081 return (cache_fpl_handled_error(fpl, EISDIR)); in cache_fplookup_degenerate()
5085 return (cache_fplookup_final_withparent(fpl)); in cache_fplookup_degenerate()
5089 cache_fpl_smr_exit(fpl); in cache_fplookup_degenerate()
5091 return (cache_fpl_aborted(fpl)); in cache_fplookup_degenerate()
5100 return (cache_fpl_aborted(fpl)); in cache_fplookup_degenerate()
5105 return (cache_fpl_handled(fpl)); in cache_fplookup_degenerate()
5109 cache_fplookup_emptypath(struct cache_fpl *fpl) in cache_fplookup_emptypath() argument
5117 fpl->tvp = fpl->dvp; in cache_fplookup_emptypath()
5118 fpl->tvp_seqc = fpl->dvp_seqc; in cache_fplookup_emptypath()
5120 ndp = fpl->ndp; in cache_fplookup_emptypath()
5121 cnp = fpl->cnp; in cache_fplookup_emptypath()
5122 tvp = fpl->tvp; in cache_fplookup_emptypath()
5127 cache_fpl_smr_exit(fpl); in cache_fplookup_emptypath()
5128 return (cache_fpl_handled_error(fpl, ENOENT)); in cache_fplookup_emptypath()
5134 cache_fpl_smr_exit(fpl); in cache_fplookup_emptypath()
5136 return (cache_fpl_aborted(fpl)); in cache_fplookup_emptypath()
5145 return (cache_fpl_aborted(fpl)); in cache_fplookup_emptypath()
5152 return (cache_fpl_handled(fpl)); in cache_fplookup_emptypath()
5156 cache_fplookup_noentry(struct cache_fpl *fpl) in cache_fplookup_noentry() argument
5165 ndp = fpl->ndp; in cache_fplookup_noentry()
5166 cnp = fpl->cnp; in cache_fplookup_noentry()
5167 dvp = fpl->dvp; in cache_fplookup_noentry()
5168 dvp_seqc = fpl->dvp_seqc; in cache_fplookup_noentry()
5180 cache_fpl_smr_exit(fpl); in cache_fplookup_noentry()
5181 return (cache_fpl_handled_error(fpl, ENAMETOOLONG)); in cache_fplookup_noentry()
5185 return (cache_fplookup_skip_slashes(fpl)); in cache_fplookup_noentry()
5189 return (cache_fplookup_emptypath(fpl)); in cache_fplookup_noentry()
5193 if (fpl->tvp == NULL) { in cache_fplookup_noentry()
5194 return (cache_fplookup_degenerate(fpl)); in cache_fplookup_noentry()
5196 return (cache_fplookup_trailingslash(fpl)); in cache_fplookup_noentry()
5200 fpl->tvp = NULL; in cache_fplookup_noentry()
5201 return (cache_fplookup_modifying(fpl)); in cache_fplookup_noentry()
5210 return (cache_fpl_partial(fpl)); in cache_fplookup_noentry()
5218 if (cache_fpl_istrailingslash(fpl)) { in cache_fplookup_noentry()
5219 return (cache_fpl_partial(fpl)); in cache_fplookup_noentry()
5227 cache_fpl_smr_exit(fpl); in cache_fplookup_noentry()
5229 return (cache_fpl_aborted(fpl)); in cache_fplookup_noentry()
5235 return (cache_fpl_aborted(fpl)); in cache_fplookup_noentry()
5241 return (cache_fpl_aborted(fpl)); in cache_fplookup_noentry()
5261 return (cache_fpl_handled_error(fpl, error)); in cache_fplookup_noentry()
5264 return (cache_fpl_aborted(fpl)); in cache_fplookup_noentry()
5267 fpl->tvp = tvp; in cache_fplookup_noentry()
5276 return (cache_fpl_handled(fpl)); in cache_fplookup_noentry()
5283 return (cache_fpl_aborted(fpl)); in cache_fplookup_noentry()
5287 if (__predict_false(cache_fplookup_is_mp(fpl))) { in cache_fplookup_noentry()
5290 return (cache_fpl_aborted(fpl)); in cache_fplookup_noentry()
5302 return (cache_fpl_handled(fpl)); in cache_fplookup_noentry()
5306 cache_fplookup_dot(struct cache_fpl *fpl) in cache_fplookup_dot() argument
5310 MPASS(!seqc_in_modify(fpl->dvp_seqc)); in cache_fplookup_dot()
5312 if (__predict_false(fpl->dvp->v_type != VDIR)) { in cache_fplookup_dot()
5313 cache_fpl_smr_exit(fpl); in cache_fplookup_dot()
5314 return (cache_fpl_handled_error(fpl, ENOTDIR)); in cache_fplookup_dot()
5322 fpl->tvp = fpl->dvp; in cache_fplookup_dot()
5323 fpl->tvp_seqc = fpl->dvp_seqc; in cache_fplookup_dot()
5325 SDT_PROBE3(vfs, namecache, lookup, hit, fpl->dvp, ".", fpl->dvp); in cache_fplookup_dot()
5328 if (cache_fplookup_is_mp(fpl)) { in cache_fplookup_dot()
5329 error = cache_fplookup_cross_mount(fpl); in cache_fplookup_dot()
5335 cache_fplookup_dotdot(struct cache_fpl *fpl) in cache_fplookup_dotdot() argument
5342 ndp = fpl->ndp; in cache_fplookup_dotdot()
5343 dvp = fpl->dvp; in cache_fplookup_dotdot()
5345 MPASS(cache_fpl_isdotdot(fpl->cnp)); in cache_fplookup_dotdot()
5351 fpl->tvp = dvp; in cache_fplookup_dotdot()
5352 fpl->tvp_seqc = vn_seqc_read_any(dvp); in cache_fplookup_dotdot()
5353 if (seqc_in_modify(fpl->tvp_seqc)) { in cache_fplookup_dotdot()
5354 return (cache_fpl_aborted(fpl)); in cache_fplookup_dotdot()
5364 return (cache_fpl_partial(fpl)); in cache_fplookup_dotdot()
5368 cache_fpl_smr_exit(fpl); in cache_fplookup_dotdot()
5369 return (cache_fpl_handled_error(fpl, ENOTDIR)); in cache_fplookup_dotdot()
5374 return (cache_fpl_aborted(fpl)); in cache_fplookup_dotdot()
5380 return (cache_fpl_aborted(fpl)); in cache_fplookup_dotdot()
5381 fpl->tvp = ncp->nc_vp; in cache_fplookup_dotdot()
5383 fpl->tvp = ncp->nc_dvp; in cache_fplookup_dotdot()
5386 fpl->tvp_seqc = vn_seqc_read_any(fpl->tvp); in cache_fplookup_dotdot()
5387 if (seqc_in_modify(fpl->tvp_seqc)) { in cache_fplookup_dotdot()
5388 return (cache_fpl_partial(fpl)); in cache_fplookup_dotdot()
5395 return (cache_fpl_aborted(fpl)); in cache_fplookup_dotdot()
5399 return (cache_fpl_aborted(fpl)); in cache_fplookup_dotdot()
5406 cache_fplookup_neg(struct cache_fpl *fpl, struct namecache *ncp, uint32_t hash) in cache_fplookup_neg() argument
5418 if (__predict_false(fpl->cnp->cn_nameiop != LOOKUP)) { in cache_fplookup_neg()
5419 fpl->tvp = NULL; in cache_fplookup_neg()
5420 return (cache_fplookup_modifying(fpl)); in cache_fplookup_neg()
5425 return (cache_fpl_partial(fpl)); in cache_fplookup_neg()
5428 return (cache_fplookup_negative_promote(fpl, ncp, hash)); in cache_fplookup_neg()
5431 cache_fpl_smr_exit(fpl); in cache_fplookup_neg()
5432 return (cache_fpl_handled_error(fpl, ENOENT)); in cache_fplookup_neg()
5442 cache_symlink_resolve(struct cache_fpl *fpl, const char *string, size_t len) in cache_symlink_resolve() argument
5448 ndp = fpl->ndp; in cache_symlink_resolve()
5449 cnp = fpl->cnp; in cache_symlink_resolve()
5456 if (cache_fpl_istrailingslash(fpl)) { in cache_symlink_resolve()
5461 ndp->ni_pathlen = fpl->nulchar - cnp->cn_nameptr - cnp->cn_namelen + 1; in cache_symlink_resolve()
5463 if (ndp->ni_pathlen != fpl->debug.ni_pathlen) { in cache_symlink_resolve()
5465 __func__, ndp->ni_pathlen, fpl->debug.ni_pathlen, fpl->nulchar, in cache_symlink_resolve()
5482 if (cache_fpl_istrailingslash(fpl)) { in cache_symlink_resolve()
5493 cache_fpl_pathlen_add(fpl, adjust); in cache_symlink_resolve()
5495 fpl->nulchar = &cnp->cn_nameptr[ndp->ni_pathlen - 1]; in cache_symlink_resolve()
5496 fpl->tvp = NULL; in cache_symlink_resolve()
5501 cache_fplookup_symlink(struct cache_fpl *fpl) in cache_fplookup_symlink() argument
5510 ndp = fpl->ndp; in cache_fplookup_symlink()
5511 cnp = fpl->cnp; in cache_fplookup_symlink()
5512 dvp = fpl->dvp; in cache_fplookup_symlink()
5513 tvp = fpl->tvp; in cache_fplookup_symlink()
5514 pwd = *(fpl->pwd); in cache_fplookup_symlink()
5518 return (cache_fplookup_final(fpl)); in cache_fplookup_symlink()
5524 return (cache_fpl_aborted(fpl)); in cache_fplookup_symlink()
5532 cache_fpl_smr_exit(fpl); in cache_fplookup_symlink()
5533 return (cache_fpl_handled_error(fpl, EACCES)); in cache_fplookup_symlink()
5536 error = VOP_FPLOOKUP_SYMLINK(tvp, fpl); in cache_fplookup_symlink()
5540 return (cache_fpl_partial(fpl)); in cache_fplookup_symlink()
5544 cache_fpl_smr_exit(fpl); in cache_fplookup_symlink()
5545 return (cache_fpl_handled_error(fpl, error)); in cache_fplookup_symlink()
5547 return (cache_fpl_aborted(fpl)); in cache_fplookup_symlink()
5552 fpl->dvp = cache_fpl_handle_root(fpl); in cache_fplookup_symlink()
5553 fpl->dvp_seqc = vn_seqc_read_any(fpl->dvp); in cache_fplookup_symlink()
5554 if (seqc_in_modify(fpl->dvp_seqc)) { in cache_fplookup_symlink()
5555 return (cache_fpl_aborted(fpl)); in cache_fplookup_symlink()
5562 mp = atomic_load_ptr(&fpl->dvp->v_mount); in cache_fplookup_symlink()
5564 return (cache_fpl_aborted(fpl)); in cache_fplookup_symlink()
5567 cache_fpl_checkpoint(fpl); in cache_fplookup_symlink()
5568 return (cache_fpl_partial(fpl)); in cache_fplookup_symlink()
5571 return (cache_fpl_aborted(fpl)); in cache_fplookup_symlink()
5578 cache_fplookup_next(struct cache_fpl *fpl) in cache_fplookup_next() argument
5587 cnp = fpl->cnp; in cache_fplookup_next()
5588 dvp = fpl->dvp; in cache_fplookup_next()
5589 hash = fpl->hash; in cache_fplookup_next()
5593 return (cache_fplookup_dot(fpl)); in cache_fplookup_next()
5596 return (cache_fplookup_dotdot(fpl)); in cache_fplookup_next()
5604 return (cache_fplookup_noentry(fpl)); in cache_fplookup_next()
5610 return (cache_fplookup_neg(fpl, ncp, hash)); in cache_fplookup_next()
5614 return (cache_fpl_partial(fpl)); in cache_fplookup_next()
5617 fpl->tvp = tvp; in cache_fplookup_next()
5618 fpl->tvp_seqc = vn_seqc_read_any(tvp); in cache_fplookup_next()
5619 if (seqc_in_modify(fpl->tvp_seqc)) { in cache_fplookup_next()
5620 return (cache_fpl_partial(fpl)); in cache_fplookup_next()
5627 if (cache_fplookup_is_mp(fpl)) { in cache_fplookup_next()
5628 error = cache_fplookup_cross_mount(fpl); in cache_fplookup_next()
5662 cache_fplookup_climb_mount(struct cache_fpl *fpl) in cache_fplookup_climb_mount() argument
5669 vp = fpl->tvp; in cache_fplookup_climb_mount()
5670 vp_seqc = fpl->tvp_seqc; in cache_fplookup_climb_mount()
5683 return (cache_fpl_partial(fpl)); in cache_fplookup_climb_mount()
5689 return (cache_fpl_partial(fpl)); in cache_fplookup_climb_mount()
5693 return (cache_fpl_partial(fpl)); in cache_fplookup_climb_mount()
5698 return (cache_fpl_partial(fpl)); in cache_fplookup_climb_mount()
5703 return (cache_fpl_partial(fpl)); in cache_fplookup_climb_mount()
5713 fpl->tvp = vp; in cache_fplookup_climb_mount()
5714 fpl->tvp_seqc = vp_seqc; in cache_fplookup_climb_mount()
5719 cache_fplookup_cross_mount(struct cache_fpl *fpl) in cache_fplookup_cross_mount() argument
5726 vp = fpl->tvp; in cache_fplookup_cross_mount()
5727 vp_seqc = fpl->tvp_seqc; in cache_fplookup_cross_mount()
5736 return (cache_fpl_partial(fpl)); in cache_fplookup_cross_mount()
5740 return (cache_fpl_partial(fpl)); in cache_fplookup_cross_mount()
5744 return (cache_fpl_partial(fpl)); in cache_fplookup_cross_mount()
5749 return (cache_fpl_partial(fpl)); in cache_fplookup_cross_mount()
5754 return (cache_fpl_partial(fpl)); in cache_fplookup_cross_mount()
5763 return (cache_fplookup_climb_mount(fpl)); in cache_fplookup_cross_mount()
5766 fpl->tvp = vp; in cache_fplookup_cross_mount()
5767 fpl->tvp_seqc = vp_seqc; in cache_fplookup_cross_mount()
5775 cache_fplookup_is_mp(struct cache_fpl *fpl) in cache_fplookup_is_mp() argument
5779 vp = fpl->tvp; in cache_fplookup_is_mp()
5797 cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) in cache_fpl_pathlen_add() argument
5800 fpl->debug.ni_pathlen += n; in cache_fpl_pathlen_add()
5801 KASSERT(fpl->debug.ni_pathlen <= PATH_MAX, in cache_fpl_pathlen_add()
5802 ("%s: pathlen overflow to %zd\n", __func__, fpl->debug.ni_pathlen)); in cache_fpl_pathlen_add()
5806 cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) in cache_fpl_pathlen_sub() argument
5809 fpl->debug.ni_pathlen -= n; in cache_fpl_pathlen_sub()
5810 KASSERT(fpl->debug.ni_pathlen <= PATH_MAX, in cache_fpl_pathlen_sub()
5811 ("%s: pathlen underflow to %zd\n", __func__, fpl->debug.ni_pathlen)); in cache_fpl_pathlen_sub()
5815 cache_fpl_pathlen_inc(struct cache_fpl *fpl) in cache_fpl_pathlen_inc() argument
5818 cache_fpl_pathlen_add(fpl, 1); in cache_fpl_pathlen_inc()
5822 cache_fpl_pathlen_dec(struct cache_fpl *fpl) in cache_fpl_pathlen_dec() argument
5825 cache_fpl_pathlen_sub(fpl, 1); in cache_fpl_pathlen_dec()
5829 cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) in cache_fpl_pathlen_add() argument
5834 cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) in cache_fpl_pathlen_sub() argument
5839 cache_fpl_pathlen_inc(struct cache_fpl *fpl) in cache_fpl_pathlen_inc() argument
5844 cache_fpl_pathlen_dec(struct cache_fpl *fpl) in cache_fpl_pathlen_dec() argument
5850 cache_fplookup_parse(struct cache_fpl *fpl) in cache_fplookup_parse() argument
5858 ndp = fpl->ndp; in cache_fplookup_parse()
5859 cnp = fpl->cnp; in cache_fplookup_parse()
5860 dvp = fpl->dvp; in cache_fplookup_parse()
5871 MPASS(&cnp->cn_nameptr[fpl->debug.ni_pathlen - 1] >= cnp->cn_pnbuf); in cache_fplookup_parse()
5872 KASSERT(&cnp->cn_nameptr[fpl->debug.ni_pathlen - 1] == fpl->nulchar, in cache_fplookup_parse()
5874 __func__, fpl->debug.ni_pathlen, &cnp->cn_nameptr[fpl->debug.ni_pathlen - 1], in cache_fplookup_parse()
5875 fpl->nulchar, cnp->cn_pnbuf)); in cache_fplookup_parse()
5876 KASSERT(*fpl->nulchar == '\0', in cache_fplookup_parse()
5877 ("%s: expected nul at %p; string [%s]\n", __func__, fpl->nulchar, in cache_fplookup_parse()
5880 *fpl->nulchar = '/'; in cache_fplookup_parse()
5888 *fpl->nulchar = '\0'; in cache_fplookup_parse()
5889 fpl->hash = cache_get_hash_iter_finish(hash); in cache_fplookup_parse()
5892 cache_fpl_pathlen_sub(fpl, cnp->cn_namelen); in cache_fplookup_parse()
5900 if (fpl->hash != cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp)) { in cache_fplookup_parse()
5917 cache_fplookup_parse_advance(struct cache_fpl *fpl) in cache_fplookup_parse_advance() argument
5922 ndp = fpl->ndp; in cache_fplookup_parse_advance()
5923 cnp = fpl->cnp; in cache_fplookup_parse_advance()
5930 cache_fpl_pathlen_dec(fpl); in cache_fplookup_parse_advance()
5943 cache_fplookup_skip_slashes(struct cache_fpl *fpl) in cache_fplookup_skip_slashes() argument
5948 ndp = fpl->ndp; in cache_fplookup_skip_slashes()
5949 cnp = fpl->cnp; in cache_fplookup_skip_slashes()
5954 cache_fpl_pathlen_dec(fpl); in cache_fplookup_skip_slashes()
5962 cache_fpl_pathlen_inc(fpl); in cache_fplookup_skip_slashes()
5972 fpl->tvp = fpl->dvp; in cache_fplookup_skip_slashes()
5973 fpl->tvp_seqc = fpl->dvp_seqc; in cache_fplookup_skip_slashes()
5996 cache_fplookup_trailingslash(struct cache_fpl *fpl) in cache_fplookup_trailingslash() argument
6009 ndp = fpl->ndp; in cache_fplookup_trailingslash()
6010 cnp = fpl->cnp; in cache_fplookup_trailingslash()
6011 tvp = fpl->tvp; in cache_fplookup_trailingslash()
6012 tvp_seqc = fpl->tvp_seqc; in cache_fplookup_trailingslash()
6014 MPASS(fpl->dvp == fpl->tvp); in cache_fplookup_trailingslash()
6015 KASSERT(cache_fpl_istrailingslash(fpl), in cache_fplookup_trailingslash()
6016 ("%s: expected trailing slash at %p; string [%s]\n", __func__, fpl->nulchar - 1, in cache_fplookup_trailingslash()
6027 return (cache_fpl_aborted(fpl)); in cache_fplookup_trailingslash()
6032 return (cache_fpl_aborted(fpl)); in cache_fplookup_trailingslash()
6034 cache_fpl_smr_exit(fpl); in cache_fplookup_trailingslash()
6035 return (cache_fpl_handled_error(fpl, ENOTDIR)); in cache_fplookup_trailingslash()
6072 cache_fpl_pathlen_add(fpl, cn_nameptr_orig - cnp->cn_nameptr); in cache_fplookup_trailingslash()
6073 cache_fpl_checkpoint(fpl); in cache_fplookup_trailingslash()
6076 ni_pathlen = fpl->nulchar - cnp->cn_nameptr + 1; in cache_fplookup_trailingslash()
6077 if (ni_pathlen != fpl->debug.ni_pathlen) { in cache_fplookup_trailingslash()
6079 __func__, ni_pathlen, fpl->debug.ni_pathlen, fpl->nulchar, in cache_fplookup_trailingslash()
6094 tvp = fpl->tvp; in cache_fplookup_trailingslash()
6097 return (cache_fpl_aborted(fpl)); in cache_fplookup_trailingslash()
6101 return (cache_fpl_aborted(fpl)); in cache_fplookup_trailingslash()
6103 fpl->dvp = ncp->nc_dvp; in cache_fplookup_trailingslash()
6104 fpl->dvp_seqc = vn_seqc_read_any(fpl->dvp); in cache_fplookup_trailingslash()
6105 if (seqc_in_modify(fpl->dvp_seqc)) { in cache_fplookup_trailingslash()
6106 return (cache_fpl_aborted(fpl)); in cache_fplookup_trailingslash()
6115 cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error) in cache_fplookup_failed_vexec() argument
6121 cnp = fpl->cnp; in cache_fplookup_failed_vexec()
6122 dvp = fpl->dvp; in cache_fplookup_failed_vexec()
6123 dvp_seqc = fpl->dvp_seqc; in cache_fplookup_failed_vexec()
6129 return (cache_fplookup_emptypath(fpl)); in cache_fplookup_failed_vexec()
6139 if (cache_fpl_istrailingslash(fpl)) { in cache_fplookup_failed_vexec()
6140 return (cache_fpl_aborted(fpl)); in cache_fplookup_failed_vexec()
6146 if (cnp->cn_nameptr[0] == '\0' && fpl->tvp == NULL) { in cache_fplookup_failed_vexec()
6147 return (cache_fplookup_degenerate(fpl)); in cache_fplookup_failed_vexec()
6154 cache_fpl_smr_exit(fpl); in cache_fplookup_failed_vexec()
6155 return (cache_fpl_handled_error(fpl, ENAMETOOLONG)); in cache_fplookup_failed_vexec()
6191 if (fpl->fsearch) { in cache_fplookup_failed_vexec()
6192 return (cache_fpl_aborted(fpl)); in cache_fplookup_failed_vexec()
6198 error = cache_fpl_aborted(fpl); in cache_fplookup_failed_vexec()
6200 cache_fpl_partial(fpl); in cache_fplookup_failed_vexec()
6205 error = cache_fpl_aborted(fpl); in cache_fplookup_failed_vexec()
6207 cache_fpl_smr_exit(fpl); in cache_fplookup_failed_vexec()
6208 cache_fpl_handled_error(fpl, error); in cache_fplookup_failed_vexec()
6216 cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) in cache_fplookup_impl() argument
6223 ndp = fpl->ndp; in cache_fplookup_impl()
6224 cnp = fpl->cnp; in cache_fplookup_impl()
6226 cache_fpl_checkpoint(fpl); in cache_fplookup_impl()
6233 fpl->dvp = dvp; in cache_fplookup_impl()
6234 fpl->dvp_seqc = vn_seqc_read_notmodify(fpl->dvp); in cache_fplookup_impl()
6238 return (cache_fpl_aborted(fpl)); in cache_fplookup_impl()
6241 MPASS(fpl->tvp == NULL); in cache_fplookup_impl()
6244 cache_fplookup_parse(fpl); in cache_fplookup_impl()
6246 error = VOP_FPLOOKUP_VEXEC(fpl->dvp, cnp->cn_cred); in cache_fplookup_impl()
6248 error = cache_fplookup_failed_vexec(fpl, error); in cache_fplookup_impl()
6252 error = cache_fplookup_next(fpl); in cache_fplookup_impl()
6253 if (__predict_false(cache_fpl_terminated(fpl))) { in cache_fplookup_impl()
6257 VNPASS(!seqc_in_modify(fpl->tvp_seqc), fpl->tvp); in cache_fplookup_impl()
6259 if (fpl->tvp->v_type == VLNK) { in cache_fplookup_impl()
6260 error = cache_fplookup_symlink(fpl); in cache_fplookup_impl()
6261 if (cache_fpl_terminated(fpl)) { in cache_fplookup_impl()
6266 error = cache_fplookup_final(fpl); in cache_fplookup_impl()
6270 if (!vn_seqc_consistent(fpl->dvp, fpl->dvp_seqc)) { in cache_fplookup_impl()
6271 error = cache_fpl_aborted(fpl); in cache_fplookup_impl()
6275 fpl->dvp = fpl->tvp; in cache_fplookup_impl()
6276 fpl->dvp_seqc = fpl->tvp_seqc; in cache_fplookup_impl()
6277 cache_fplookup_parse_advance(fpl); in cache_fplookup_impl()
6280 cache_fpl_checkpoint(fpl); in cache_fplookup_impl()
6366 struct cache_fpl fpl; in cache_fplookup() local
6372 fpl.status = CACHE_FPL_STATUS_UNSET; in cache_fplookup()
6373 fpl.in_smr = false; in cache_fplookup()
6374 fpl.ndp = ndp; in cache_fplookup()
6375 fpl.cnp = cnp = &ndp->ni_cnd; in cache_fplookup()
6383 if (__predict_false(!cache_can_fplookup(&fpl))) { in cache_fplookup()
6384 *status = fpl.status; in cache_fplookup()
6385 SDT_PROBE3(vfs, fplookup, lookup, done, ndp, fpl.line, fpl.status); in cache_fplookup()
6389 cache_fpl_checkpoint_outer(&fpl); in cache_fplookup()
6391 cache_fpl_smr_enter_initial(&fpl); in cache_fplookup()
6393 fpl.debug.ni_pathlen = ndp->ni_pathlen; in cache_fplookup()
6395 fpl.nulchar = &cnp->cn_nameptr[ndp->ni_pathlen - 1]; in cache_fplookup()
6396 fpl.fsearch = false; in cache_fplookup()
6397 fpl.tvp = NULL; /* for degenerate path handling */ in cache_fplookup()
6398 fpl.pwd = pwdp; in cache_fplookup()
6400 *(fpl.pwd) = pwd; in cache_fplookup()
6405 dvp = cache_fpl_handle_root(&fpl); in cache_fplookup()
6411 error = cache_fplookup_dirfd(&fpl, &dvp); in cache_fplookup()
6419 error = cache_fplookup_impl(dvp, &fpl); in cache_fplookup()
6421 cache_fpl_smr_assert_not_entered(&fpl); in cache_fplookup()
6422 cache_fpl_assert_status(&fpl); in cache_fplookup()
6423 *status = fpl.status; in cache_fplookup()
6424 SDT_PROBE3(vfs, fplookup, lookup, done, ndp, fpl.line, fpl.status); in cache_fplookup()
6425 if (__predict_true(fpl.status == CACHE_FPL_STATUS_HANDLED)) { in cache_fplookup()
6430 cache_fpl_cleanup_cnp(fpl.cnp); in cache_fplookup()
6431 MPASS(fpl.dvp == NULL); in cache_fplookup()
6432 MPASS(fpl.tvp == NULL); in cache_fplookup()
6434 ndp->ni_dvp = fpl.dvp; in cache_fplookup()
6435 ndp->ni_vp = fpl.tvp; in cache_fplookup()