Lines Matching refs:fpl

3735 static bool cache_fplookup_is_mp(struct cache_fpl *fpl);
3736 static int cache_fplookup_cross_mount(struct cache_fpl *fpl);
3737 static int cache_fplookup_partial_setup(struct cache_fpl *fpl);
3738 static int cache_fplookup_skip_slashes(struct cache_fpl *fpl);
3739 static int cache_fplookup_trailingslash(struct cache_fpl *fpl);
3740 static void cache_fpl_pathlen_dec(struct cache_fpl *fpl);
3741 static void cache_fpl_pathlen_inc(struct cache_fpl *fpl);
3742 static void cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n);
3743 static void cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n);
3757 cache_fpl_handle_root(struct cache_fpl *fpl) in cache_fpl_handle_root() argument
3762 ndp = fpl->ndp; in cache_fpl_handle_root()
3763 cnp = fpl->cnp; in cache_fpl_handle_root()
3767 cache_fpl_pathlen_dec(fpl); in cache_fpl_handle_root()
3772 cache_fpl_pathlen_dec(fpl); in cache_fpl_handle_root()
3780 cache_fpl_checkpoint_outer(struct cache_fpl *fpl) in cache_fpl_checkpoint_outer() argument
3783 fpl->snd_outer.ni_pathlen = fpl->ndp->ni_pathlen; in cache_fpl_checkpoint_outer()
3784 fpl->snd_outer.cn_flags = fpl->ndp->ni_cnd.cn_flags; in cache_fpl_checkpoint_outer()
3788 cache_fpl_checkpoint(struct cache_fpl *fpl) in cache_fpl_checkpoint() argument
3792 fpl->snd.cn_nameptr = fpl->ndp->ni_cnd.cn_nameptr; in cache_fpl_checkpoint()
3793 fpl->snd.ni_pathlen = fpl->debug.ni_pathlen; in cache_fpl_checkpoint()
3798 cache_fpl_restore_partial(struct cache_fpl *fpl) in cache_fpl_restore_partial() argument
3801 fpl->ndp->ni_cnd.cn_flags = fpl->snd_outer.cn_flags; in cache_fpl_restore_partial()
3803 fpl->debug.ni_pathlen = fpl->snd.ni_pathlen; in cache_fpl_restore_partial()
3808 cache_fpl_restore_abort(struct cache_fpl *fpl) in cache_fpl_restore_abort() argument
3811 cache_fpl_restore_partial(fpl); in cache_fpl_restore_abort()
3815 fpl->ndp->ni_resflags = 0; in cache_fpl_restore_abort()
3816 fpl->ndp->ni_cnd.cn_nameptr = fpl->ndp->ni_cnd.cn_pnbuf; in cache_fpl_restore_abort()
3817 fpl->ndp->ni_pathlen = fpl->snd_outer.ni_pathlen; in cache_fpl_restore_abort()
3821 #define cache_fpl_smr_assert_entered(fpl) ({ \ argument
3822 struct cache_fpl *_fpl = (fpl); \
3826 #define cache_fpl_smr_assert_not_entered(fpl) ({ \ argument
3827 struct cache_fpl *_fpl = (fpl); \
3832 cache_fpl_assert_status(struct cache_fpl *fpl) in cache_fpl_assert_status() argument
3835 switch (fpl->status) { in cache_fpl_assert_status()
3847 #define cache_fpl_smr_assert_entered(fpl) do { } while (0) argument
3848 #define cache_fpl_smr_assert_not_entered(fpl) do { } while (0) argument
3849 #define cache_fpl_assert_status(fpl) do { } while (0) argument
3852 #define cache_fpl_smr_enter_initial(fpl) ({ \ argument
3853 struct cache_fpl *_fpl = (fpl); \
3858 #define cache_fpl_smr_enter(fpl) ({ \ argument
3859 struct cache_fpl *_fpl = (fpl); \
3865 #define cache_fpl_smr_exit(fpl) ({ \ argument
3866 struct cache_fpl *_fpl = (fpl); \
3873 cache_fpl_aborted_early_impl(struct cache_fpl *fpl, int line) in cache_fpl_aborted_early_impl() argument
3876 if (fpl->status != CACHE_FPL_STATUS_UNSET) { in cache_fpl_aborted_early_impl()
3877 KASSERT(fpl->status == CACHE_FPL_STATUS_PARTIAL, in cache_fpl_aborted_early_impl()
3879 __func__, fpl->status, line, fpl->line)); in cache_fpl_aborted_early_impl()
3881 cache_fpl_smr_assert_not_entered(fpl); in cache_fpl_aborted_early_impl()
3882 fpl->status = CACHE_FPL_STATUS_ABORTED; in cache_fpl_aborted_early_impl()
3883 fpl->line = line; in cache_fpl_aborted_early_impl()
3890 cache_fpl_aborted_impl(struct cache_fpl *fpl, int line) in cache_fpl_aborted_impl() argument
3895 ndp = fpl->ndp; in cache_fpl_aborted_impl()
3896 cnp = fpl->cnp; in cache_fpl_aborted_impl()
3898 if (fpl->status != CACHE_FPL_STATUS_UNSET) { in cache_fpl_aborted_impl()
3899 KASSERT(fpl->status == CACHE_FPL_STATUS_PARTIAL, in cache_fpl_aborted_impl()
3901 __func__, fpl->status, line, fpl->line)); in cache_fpl_aborted_impl()
3903 fpl->status = CACHE_FPL_STATUS_ABORTED; in cache_fpl_aborted_impl()
3904 fpl->line = line; in cache_fpl_aborted_impl()
3905 if (fpl->in_smr) in cache_fpl_aborted_impl()
3906 cache_fpl_smr_exit(fpl); in cache_fpl_aborted_impl()
3907 cache_fpl_restore_abort(fpl); in cache_fpl_aborted_impl()
3913 fpl->status = CACHE_FPL_STATUS_DESTROYED; in cache_fpl_aborted_impl()
3922 cache_fpl_partial_impl(struct cache_fpl *fpl, int line) in cache_fpl_partial_impl() argument
3925 KASSERT(fpl->status == CACHE_FPL_STATUS_UNSET, in cache_fpl_partial_impl()
3927 __func__, line, fpl->status, fpl->line)); in cache_fpl_partial_impl()
3928 cache_fpl_smr_assert_entered(fpl); in cache_fpl_partial_impl()
3929 fpl->status = CACHE_FPL_STATUS_PARTIAL; in cache_fpl_partial_impl()
3930 fpl->line = line; in cache_fpl_partial_impl()
3931 return (cache_fplookup_partial_setup(fpl)); in cache_fpl_partial_impl()
3937 cache_fpl_handled_impl(struct cache_fpl *fpl, int line) in cache_fpl_handled_impl() argument
3940 KASSERT(fpl->status == CACHE_FPL_STATUS_UNSET, in cache_fpl_handled_impl()
3942 __func__, line, fpl->status, fpl->line)); in cache_fpl_handled_impl()
3943 cache_fpl_smr_assert_not_entered(fpl); in cache_fpl_handled_impl()
3944 fpl->status = CACHE_FPL_STATUS_HANDLED; in cache_fpl_handled_impl()
3945 fpl->line = line; in cache_fpl_handled_impl()
3952 cache_fpl_handled_error_impl(struct cache_fpl *fpl, int error, int line) in cache_fpl_handled_error_impl() argument
3955 KASSERT(fpl->status == CACHE_FPL_STATUS_UNSET, in cache_fpl_handled_error_impl()
3957 __func__, line, fpl->status, fpl->line)); in cache_fpl_handled_error_impl()
3960 cache_fpl_smr_assert_not_entered(fpl); in cache_fpl_handled_error_impl()
3961 fpl->status = CACHE_FPL_STATUS_HANDLED; in cache_fpl_handled_error_impl()
3962 fpl->line = line; in cache_fpl_handled_error_impl()
3963 fpl->dvp = NULL; in cache_fpl_handled_error_impl()
3964 fpl->tvp = NULL; in cache_fpl_handled_error_impl()
3965 fpl->savename = false; in cache_fpl_handled_error_impl()
3972 cache_fpl_terminated(struct cache_fpl *fpl) in cache_fpl_terminated() argument
3975 return (fpl->status != CACHE_FPL_STATUS_UNSET); in cache_fpl_terminated()
3997 cache_fpl_istrailingslash(struct cache_fpl *fpl) in cache_fpl_istrailingslash() argument
4000 return (*(fpl->nulchar - 1) == '/'); in cache_fpl_istrailingslash()
4014 cache_can_fplookup(struct cache_fpl *fpl) in cache_can_fplookup() argument
4020 ndp = fpl->ndp; in cache_can_fplookup()
4021 cnp = fpl->cnp; in cache_can_fplookup()
4025 cache_fpl_aborted_early(fpl); in cache_can_fplookup()
4029 cache_fpl_aborted_early(fpl); in cache_can_fplookup()
4033 cache_fpl_aborted_early(fpl); in cache_can_fplookup()
4037 cache_fpl_aborted_early(fpl); in cache_can_fplookup()
4041 cache_fpl_aborted_early(fpl); in cache_can_fplookup()
4048 cache_fplookup_dirfd(struct cache_fpl *fpl, struct vnode **vpp) in cache_fplookup_dirfd() argument
4054 ndp = fpl->ndp; in cache_fplookup_dirfd()
4057 return (cache_fpl_aborted(fpl)); in cache_fplookup_dirfd()
4059 fpl->fsearch = fsearch; in cache_fplookup_dirfd()
4064 cache_fplookup_negative_promote(struct cache_fpl *fpl, struct namecache *oncp, in cache_fplookup_negative_promote() argument
4070 cnp = fpl->cnp; in cache_fplookup_negative_promote()
4071 dvp = fpl->dvp; in cache_fplookup_negative_promote()
4073 cache_fpl_smr_exit(fpl); in cache_fplookup_negative_promote()
4075 return (cache_fpl_handled_error(fpl, ENOENT)); in cache_fplookup_negative_promote()
4077 return (cache_fpl_aborted(fpl)); in cache_fplookup_negative_promote()
4084 cache_fplookup_partial_setup(struct cache_fpl *fpl) in cache_fplookup_partial_setup() argument
4093 ndp = fpl->ndp; in cache_fplookup_partial_setup()
4094 cnp = fpl->cnp; in cache_fplookup_partial_setup()
4095 pwd = *(fpl->pwd); in cache_fplookup_partial_setup()
4096 dvp = fpl->dvp; in cache_fplookup_partial_setup()
4097 dvp_seqc = fpl->dvp_seqc; in cache_fplookup_partial_setup()
4100 return (cache_fpl_aborted(fpl)); in cache_fplookup_partial_setup()
4114 cache_fpl_smr_exit(fpl); in cache_fplookup_partial_setup()
4117 return (cache_fpl_aborted(fpl)); in cache_fplookup_partial_setup()
4124 return (cache_fpl_aborted(fpl)); in cache_fplookup_partial_setup()
4127 cache_fpl_restore_partial(fpl); in cache_fplookup_partial_setup()
4129 if (cnp->cn_nameptr != fpl->snd.cn_nameptr) { in cache_fplookup_partial_setup()
4131 cnp->cn_nameptr, fpl->snd.cn_nameptr, cnp->cn_pnbuf); in cache_fplookup_partial_setup()
4149 cache_fpl_pathlen_dec(fpl); in cache_fplookup_partial_setup()
4153 ndp->ni_pathlen = fpl->nulchar - cnp->cn_nameptr + 1; in cache_fplookup_partial_setup()
4155 if (ndp->ni_pathlen != fpl->debug.ni_pathlen) { in cache_fplookup_partial_setup()
4157 __func__, ndp->ni_pathlen, fpl->debug.ni_pathlen, fpl->nulchar, in cache_fplookup_partial_setup()
4165 cache_fplookup_final_child(struct cache_fpl *fpl, enum vgetstate tvs) in cache_fplookup_final_child() argument
4172 cnp = fpl->cnp; in cache_fplookup_final_child()
4173 tvp = fpl->tvp; in cache_fplookup_final_child()
4174 tvp_seqc = fpl->tvp_seqc; in cache_fplookup_final_child()
4182 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_child()
4193 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_child()
4196 return (cache_fpl_handled(fpl)); in cache_fplookup_final_child()
4203 cache_fplookup_final_modifying(struct cache_fpl *fpl) in cache_fplookup_final_modifying() argument
4214 ndp = fpl->ndp; in cache_fplookup_final_modifying()
4215 cnp = fpl->cnp; in cache_fplookup_final_modifying()
4216 dvp = fpl->dvp; in cache_fplookup_final_modifying()
4217 dvp_seqc = fpl->dvp_seqc; in cache_fplookup_final_modifying()
4238 if (cache_fpl_istrailingslash(fpl)) { in cache_fplookup_final_modifying()
4239 return (cache_fpl_partial(fpl)); in cache_fplookup_final_modifying()
4244 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4248 cache_fpl_smr_exit(fpl); in cache_fplookup_final_modifying()
4254 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4256 return (cache_fpl_handled_error(fpl, EROFS)); in cache_fplookup_final_modifying()
4259 if (fpl->tvp != NULL && (cnp->cn_flags & FAILIFEXISTS) != 0) { in cache_fplookup_final_modifying()
4260 cache_fpl_smr_exit(fpl); in cache_fplookup_final_modifying()
4261 return (cache_fpl_handled_error(fpl, EEXIST)); in cache_fplookup_final_modifying()
4279 cache_fpl_smr_exit(fpl); in cache_fplookup_final_modifying()
4281 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4287 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4293 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4311 return (cache_fpl_handled_error(fpl, error)); in cache_fplookup_final_modifying()
4314 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4317 fpl->tvp = tvp; in cache_fplookup_final_modifying()
4318 fpl->savename = (cnp->cn_flags & SAVENAME) != 0; in cache_fplookup_final_modifying()
4325 fpl->savename = true; in cache_fplookup_final_modifying()
4331 return (cache_fpl_handled(fpl)); in cache_fplookup_final_modifying()
4344 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4355 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4363 if (__predict_false(cache_fplookup_is_mp(fpl))) { in cache_fplookup_final_modifying()
4366 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_modifying()
4372 return (cache_fpl_handled_error(fpl, EEXIST)); in cache_fplookup_final_modifying()
4387 fpl->savename = true; in cache_fplookup_final_modifying()
4390 return (cache_fpl_handled(fpl)); in cache_fplookup_final_modifying()
4394 cache_fplookup_modifying(struct cache_fpl *fpl) in cache_fplookup_modifying() argument
4398 ndp = fpl->ndp; in cache_fplookup_modifying()
4401 return (cache_fpl_partial(fpl)); in cache_fplookup_modifying()
4403 return (cache_fplookup_final_modifying(fpl)); in cache_fplookup_modifying()
4407 cache_fplookup_final_withparent(struct cache_fpl *fpl) in cache_fplookup_final_withparent() argument
4415 cnp = fpl->cnp; in cache_fplookup_final_withparent()
4416 dvp = fpl->dvp; in cache_fplookup_final_withparent()
4417 dvp_seqc = fpl->dvp_seqc; in cache_fplookup_final_withparent()
4418 tvp = fpl->tvp; in cache_fplookup_final_withparent()
4427 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_withparent()
4431 cache_fpl_smr_exit(fpl); in cache_fplookup_final_withparent()
4433 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_withparent()
4436 cache_fpl_smr_exit(fpl); in cache_fplookup_final_withparent()
4442 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_withparent()
4454 return (cache_fpl_aborted(fpl)); in cache_fplookup_final_withparent()
4457 error = cache_fplookup_final_child(fpl, tvs); in cache_fplookup_final_withparent()
4459 MPASS(fpl->status == CACHE_FPL_STATUS_ABORTED); in cache_fplookup_final_withparent()
4467 MPASS(fpl->status == CACHE_FPL_STATUS_HANDLED); in cache_fplookup_final_withparent()
4472 cache_fplookup_final(struct cache_fpl *fpl) in cache_fplookup_final() argument
4479 cnp = fpl->cnp; in cache_fplookup_final()
4480 dvp = fpl->dvp; in cache_fplookup_final()
4481 dvp_seqc = fpl->dvp_seqc; in cache_fplookup_final()
4482 tvp = fpl->tvp; in cache_fplookup_final()
4487 return (cache_fplookup_final_modifying(fpl)); in cache_fplookup_final()
4491 return (cache_fplookup_final_withparent(fpl)); in cache_fplookup_final()
4495 return (cache_fpl_partial(fpl)); in cache_fplookup_final()
4499 cache_fpl_smr_exit(fpl); in cache_fplookup_final()
4501 return (cache_fpl_aborted(fpl)); in cache_fplookup_final()
4504 cache_fpl_smr_exit(fpl); in cache_fplookup_final()
4505 return (cache_fplookup_final_child(fpl, tvs)); in cache_fplookup_final()
4514 cache_fplookup_degenerate(struct cache_fpl *fpl) in cache_fplookup_degenerate() argument
4524 fpl->tvp = fpl->dvp; in cache_fplookup_degenerate()
4525 fpl->tvp_seqc = fpl->dvp_seqc; in cache_fplookup_degenerate()
4527 cnp = fpl->cnp; in cache_fplookup_degenerate()
4528 dvp = fpl->dvp; in cache_fplookup_degenerate()
4539 cache_fpl_smr_exit(fpl); in cache_fplookup_degenerate()
4540 return (cache_fpl_handled_error(fpl, EISDIR)); in cache_fplookup_degenerate()
4546 return (cache_fplookup_final_withparent(fpl)); in cache_fplookup_degenerate()
4550 cache_fpl_smr_exit(fpl); in cache_fplookup_degenerate()
4552 return (cache_fpl_aborted(fpl)); in cache_fplookup_degenerate()
4561 return (cache_fpl_aborted(fpl)); in cache_fplookup_degenerate()
4566 return (cache_fpl_handled(fpl)); in cache_fplookup_degenerate()
4570 cache_fplookup_noentry(struct cache_fpl *fpl) in cache_fplookup_noentry() argument
4580 ndp = fpl->ndp; in cache_fplookup_noentry()
4581 cnp = fpl->cnp; in cache_fplookup_noentry()
4582 dvp = fpl->dvp; in cache_fplookup_noentry()
4583 dvp_seqc = fpl->dvp_seqc; in cache_fplookup_noentry()
4593 cache_fpl_smr_exit(fpl); in cache_fplookup_noentry()
4594 return (cache_fpl_handled_error(fpl, ENAMETOOLONG)); in cache_fplookup_noentry()
4598 return (cache_fplookup_skip_slashes(fpl)); in cache_fplookup_noentry()
4602 if (fpl->tvp == NULL) { in cache_fplookup_noentry()
4603 return (cache_fplookup_degenerate(fpl)); in cache_fplookup_noentry()
4605 return (cache_fplookup_trailingslash(fpl)); in cache_fplookup_noentry()
4609 fpl->tvp = NULL; in cache_fplookup_noentry()
4610 return (cache_fplookup_modifying(fpl)); in cache_fplookup_noentry()
4621 return (cache_fpl_partial(fpl)); in cache_fplookup_noentry()
4629 if (cache_fpl_istrailingslash(fpl)) { in cache_fplookup_noentry()
4630 return (cache_fpl_partial(fpl)); in cache_fplookup_noentry()
4638 cache_fpl_smr_exit(fpl); in cache_fplookup_noentry()
4640 return (cache_fpl_aborted(fpl)); in cache_fplookup_noentry()
4646 return (cache_fpl_aborted(fpl)); in cache_fplookup_noentry()
4652 return (cache_fpl_aborted(fpl)); in cache_fplookup_noentry()
4675 return (cache_fpl_handled_error(fpl, error)); in cache_fplookup_noentry()
4678 return (cache_fpl_aborted(fpl)); in cache_fplookup_noentry()
4681 fpl->tvp = tvp; in cache_fplookup_noentry()
4682 if (!fpl->savename) { in cache_fplookup_noentry()
4693 return (cache_fpl_handled(fpl)); in cache_fplookup_noentry()
4700 return (cache_fpl_aborted(fpl)); in cache_fplookup_noentry()
4704 if (__predict_false(cache_fplookup_is_mp(fpl))) { in cache_fplookup_noentry()
4707 return (cache_fpl_aborted(fpl)); in cache_fplookup_noentry()
4719 return (cache_fpl_handled(fpl)); in cache_fplookup_noentry()
4723 cache_fplookup_dot(struct cache_fpl *fpl) in cache_fplookup_dot() argument
4727 MPASS(!seqc_in_modify(fpl->dvp_seqc)); in cache_fplookup_dot()
4733 fpl->tvp = fpl->dvp; in cache_fplookup_dot()
4734 fpl->tvp_seqc = fpl->dvp_seqc; in cache_fplookup_dot()
4737 SDT_PROBE3(vfs, namecache, lookup, hit, fpl->dvp, ".", fpl->dvp); in cache_fplookup_dot()
4740 if (cache_fplookup_is_mp(fpl)) { in cache_fplookup_dot()
4741 error = cache_fplookup_cross_mount(fpl); in cache_fplookup_dot()
4747 cache_fplookup_dotdot(struct cache_fpl *fpl) in cache_fplookup_dotdot() argument
4756 ndp = fpl->ndp; in cache_fplookup_dotdot()
4757 cnp = fpl->cnp; in cache_fplookup_dotdot()
4758 dvp = fpl->dvp; in cache_fplookup_dotdot()
4774 fpl->tvp = dvp; in cache_fplookup_dotdot()
4775 fpl->tvp_seqc = vn_seqc_read_any(dvp); in cache_fplookup_dotdot()
4776 if (seqc_in_modify(fpl->tvp_seqc)) { in cache_fplookup_dotdot()
4777 return (cache_fpl_aborted(fpl)); in cache_fplookup_dotdot()
4787 return (cache_fpl_partial(fpl)); in cache_fplookup_dotdot()
4792 return (cache_fpl_aborted(fpl)); in cache_fplookup_dotdot()
4798 return (cache_fpl_aborted(fpl)); in cache_fplookup_dotdot()
4799 fpl->tvp = ncp->nc_vp; in cache_fplookup_dotdot()
4801 fpl->tvp = ncp->nc_dvp; in cache_fplookup_dotdot()
4804 fpl->tvp_seqc = vn_seqc_read_any(fpl->tvp); in cache_fplookup_dotdot()
4805 if (seqc_in_modify(fpl->tvp_seqc)) { in cache_fplookup_dotdot()
4806 return (cache_fpl_partial(fpl)); in cache_fplookup_dotdot()
4813 return (cache_fpl_aborted(fpl)); in cache_fplookup_dotdot()
4817 return (cache_fpl_aborted(fpl)); in cache_fplookup_dotdot()
4825 cache_fplookup_neg(struct cache_fpl *fpl, struct namecache *ncp, uint32_t hash) in cache_fplookup_neg() argument
4835 if (__predict_false(fpl->cnp->cn_nameiop != LOOKUP)) { in cache_fplookup_neg()
4836 fpl->tvp = NULL; in cache_fplookup_neg()
4837 return (cache_fplookup_modifying(fpl)); in cache_fplookup_neg()
4842 return (cache_fpl_partial(fpl)); in cache_fplookup_neg()
4845 return (cache_fplookup_negative_promote(fpl, ncp, hash)); in cache_fplookup_neg()
4848 cache_fpl_smr_exit(fpl); in cache_fplookup_neg()
4849 return (cache_fpl_handled_error(fpl, ENOENT)); in cache_fplookup_neg()
4859 cache_symlink_resolve(struct cache_fpl *fpl, const char *string, size_t len) in cache_symlink_resolve() argument
4865 ndp = fpl->ndp; in cache_symlink_resolve()
4866 cnp = fpl->cnp; in cache_symlink_resolve()
4873 if (cache_fpl_istrailingslash(fpl)) { in cache_symlink_resolve()
4878 ndp->ni_pathlen = fpl->nulchar - cnp->cn_nameptr - cnp->cn_namelen + 1; in cache_symlink_resolve()
4880 if (ndp->ni_pathlen != fpl->debug.ni_pathlen) { in cache_symlink_resolve()
4882 __func__, ndp->ni_pathlen, fpl->debug.ni_pathlen, fpl->nulchar, in cache_symlink_resolve()
4899 if (cache_fpl_istrailingslash(fpl)) { in cache_symlink_resolve()
4910 cache_fpl_pathlen_add(fpl, adjust); in cache_symlink_resolve()
4912 fpl->nulchar = &cnp->cn_nameptr[ndp->ni_pathlen - 1]; in cache_symlink_resolve()
4913 fpl->tvp = NULL; in cache_symlink_resolve()
4918 cache_fplookup_symlink(struct cache_fpl *fpl) in cache_fplookup_symlink() argument
4926 ndp = fpl->ndp; in cache_fplookup_symlink()
4927 cnp = fpl->cnp; in cache_fplookup_symlink()
4928 dvp = fpl->dvp; in cache_fplookup_symlink()
4929 tvp = fpl->tvp; in cache_fplookup_symlink()
4933 return (cache_fplookup_final(fpl)); in cache_fplookup_symlink()
4939 return (cache_fpl_aborted(fpl)); in cache_fplookup_symlink()
4947 cache_fpl_smr_exit(fpl); in cache_fplookup_symlink()
4948 return (cache_fpl_handled_error(fpl, EACCES)); in cache_fplookup_symlink()
4951 error = VOP_FPLOOKUP_SYMLINK(tvp, fpl); in cache_fplookup_symlink()
4955 return (cache_fpl_partial(fpl)); in cache_fplookup_symlink()
4959 cache_fpl_smr_exit(fpl); in cache_fplookup_symlink()
4960 return (cache_fpl_handled_error(fpl, error)); in cache_fplookup_symlink()
4962 return (cache_fpl_aborted(fpl)); in cache_fplookup_symlink()
4967 fpl->dvp = cache_fpl_handle_root(fpl); in cache_fplookup_symlink()
4968 fpl->dvp_seqc = vn_seqc_read_any(fpl->dvp); in cache_fplookup_symlink()
4969 if (seqc_in_modify(fpl->dvp_seqc)) { in cache_fplookup_symlink()
4970 return (cache_fpl_aborted(fpl)); in cache_fplookup_symlink()
4977 cache_fplookup_next(struct cache_fpl *fpl) in cache_fplookup_next() argument
4986 cnp = fpl->cnp; in cache_fplookup_next()
4987 dvp = fpl->dvp; in cache_fplookup_next()
4988 hash = fpl->hash; in cache_fplookup_next()
4992 return (cache_fplookup_dot(fpl)); in cache_fplookup_next()
4995 return (cache_fplookup_dotdot(fpl)); in cache_fplookup_next()
5008 return (cache_fplookup_noentry(fpl)); in cache_fplookup_next()
5014 return (cache_fplookup_neg(fpl, ncp, hash)); in cache_fplookup_next()
5018 return (cache_fpl_partial(fpl)); in cache_fplookup_next()
5021 fpl->tvp = tvp; in cache_fplookup_next()
5022 fpl->tvp_seqc = vn_seqc_read_any(tvp); in cache_fplookup_next()
5023 if (seqc_in_modify(fpl->tvp_seqc)) { in cache_fplookup_next()
5024 return (cache_fpl_partial(fpl)); in cache_fplookup_next()
5031 if (cache_fplookup_is_mp(fpl)) { in cache_fplookup_next()
5032 error = cache_fplookup_cross_mount(fpl); in cache_fplookup_next()
5066 cache_fplookup_climb_mount(struct cache_fpl *fpl) in cache_fplookup_climb_mount() argument
5073 vp = fpl->tvp; in cache_fplookup_climb_mount()
5074 vp_seqc = fpl->tvp_seqc; in cache_fplookup_climb_mount()
5087 return (cache_fpl_partial(fpl)); in cache_fplookup_climb_mount()
5093 return (cache_fpl_partial(fpl)); in cache_fplookup_climb_mount()
5097 return (cache_fpl_partial(fpl)); in cache_fplookup_climb_mount()
5102 return (cache_fpl_partial(fpl)); in cache_fplookup_climb_mount()
5107 return (cache_fpl_partial(fpl)); in cache_fplookup_climb_mount()
5117 fpl->tvp = vp; in cache_fplookup_climb_mount()
5118 fpl->tvp_seqc = vp_seqc; in cache_fplookup_climb_mount()
5123 cache_fplookup_cross_mount(struct cache_fpl *fpl) in cache_fplookup_cross_mount() argument
5130 vp = fpl->tvp; in cache_fplookup_cross_mount()
5131 vp_seqc = fpl->tvp_seqc; in cache_fplookup_cross_mount()
5140 return (cache_fpl_partial(fpl)); in cache_fplookup_cross_mount()
5144 return (cache_fpl_partial(fpl)); in cache_fplookup_cross_mount()
5148 return (cache_fpl_partial(fpl)); in cache_fplookup_cross_mount()
5153 return (cache_fpl_partial(fpl)); in cache_fplookup_cross_mount()
5158 return (cache_fpl_partial(fpl)); in cache_fplookup_cross_mount()
5167 return (cache_fplookup_climb_mount(fpl)); in cache_fplookup_cross_mount()
5170 fpl->tvp = vp; in cache_fplookup_cross_mount()
5171 fpl->tvp_seqc = vp_seqc; in cache_fplookup_cross_mount()
5179 cache_fplookup_is_mp(struct cache_fpl *fpl) in cache_fplookup_is_mp() argument
5183 vp = fpl->tvp; in cache_fplookup_is_mp()
5201 cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) in cache_fpl_pathlen_add() argument
5204 fpl->debug.ni_pathlen += n; in cache_fpl_pathlen_add()
5205 KASSERT(fpl->debug.ni_pathlen <= PATH_MAX, in cache_fpl_pathlen_add()
5206 ("%s: pathlen overflow to %zd\n", __func__, fpl->debug.ni_pathlen)); in cache_fpl_pathlen_add()
5210 cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) in cache_fpl_pathlen_sub() argument
5213 fpl->debug.ni_pathlen -= n; in cache_fpl_pathlen_sub()
5214 KASSERT(fpl->debug.ni_pathlen <= PATH_MAX, in cache_fpl_pathlen_sub()
5215 ("%s: pathlen underflow to %zd\n", __func__, fpl->debug.ni_pathlen)); in cache_fpl_pathlen_sub()
5219 cache_fpl_pathlen_inc(struct cache_fpl *fpl) in cache_fpl_pathlen_inc() argument
5222 cache_fpl_pathlen_add(fpl, 1); in cache_fpl_pathlen_inc()
5226 cache_fpl_pathlen_dec(struct cache_fpl *fpl) in cache_fpl_pathlen_dec() argument
5229 cache_fpl_pathlen_sub(fpl, 1); in cache_fpl_pathlen_dec()
5233 cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) in cache_fpl_pathlen_add() argument
5238 cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) in cache_fpl_pathlen_sub() argument
5243 cache_fpl_pathlen_inc(struct cache_fpl *fpl) in cache_fpl_pathlen_inc() argument
5248 cache_fpl_pathlen_dec(struct cache_fpl *fpl) in cache_fpl_pathlen_dec() argument
5254 cache_fplookup_parse(struct cache_fpl *fpl) in cache_fplookup_parse() argument
5262 ndp = fpl->ndp; in cache_fplookup_parse()
5263 cnp = fpl->cnp; in cache_fplookup_parse()
5264 dvp = fpl->dvp; in cache_fplookup_parse()
5275 KASSERT(&cnp->cn_nameptr[fpl->debug.ni_pathlen - 1] == fpl->nulchar, in cache_fplookup_parse()
5277 __func__, fpl->debug.ni_pathlen, &cnp->cn_nameptr[fpl->debug.ni_pathlen - 1], in cache_fplookup_parse()
5278 fpl->nulchar, cnp->cn_pnbuf)); in cache_fplookup_parse()
5279 KASSERT(*fpl->nulchar == '\0', in cache_fplookup_parse()
5280 ("%s: expected nul at %p; string [%s]\n", __func__, fpl->nulchar, in cache_fplookup_parse()
5283 *fpl->nulchar = '/'; in cache_fplookup_parse()
5291 *fpl->nulchar = '\0'; in cache_fplookup_parse()
5292 fpl->hash = cache_get_hash_iter_finish(hash); in cache_fplookup_parse()
5295 cache_fpl_pathlen_sub(fpl, cnp->cn_namelen); in cache_fplookup_parse()
5299 if (fpl->hash != cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp)) { in cache_fplookup_parse()
5316 cache_fplookup_parse_advance(struct cache_fpl *fpl) in cache_fplookup_parse_advance() argument
5321 ndp = fpl->ndp; in cache_fplookup_parse_advance()
5322 cnp = fpl->cnp; in cache_fplookup_parse_advance()
5329 cache_fpl_pathlen_dec(fpl); in cache_fplookup_parse_advance()
5342 cache_fplookup_skip_slashes(struct cache_fpl *fpl) in cache_fplookup_skip_slashes() argument
5347 ndp = fpl->ndp; in cache_fplookup_skip_slashes()
5348 cnp = fpl->cnp; in cache_fplookup_skip_slashes()
5353 cache_fpl_pathlen_dec(fpl); in cache_fplookup_skip_slashes()
5361 cache_fpl_pathlen_inc(fpl); in cache_fplookup_skip_slashes()
5371 fpl->tvp = fpl->dvp; in cache_fplookup_skip_slashes()
5372 fpl->tvp_seqc = fpl->dvp_seqc; in cache_fplookup_skip_slashes()
5395 cache_fplookup_trailingslash(struct cache_fpl *fpl) in cache_fplookup_trailingslash() argument
5408 ndp = fpl->ndp; in cache_fplookup_trailingslash()
5409 cnp = fpl->cnp; in cache_fplookup_trailingslash()
5410 tvp = fpl->tvp; in cache_fplookup_trailingslash()
5411 tvp_seqc = fpl->tvp_seqc; in cache_fplookup_trailingslash()
5413 MPASS(fpl->dvp == fpl->tvp); in cache_fplookup_trailingslash()
5414 KASSERT(cache_fpl_istrailingslash(fpl), in cache_fplookup_trailingslash()
5415 ("%s: expected trailing slash at %p; string [%s]\n", __func__, fpl->nulchar - 1, in cache_fplookup_trailingslash()
5426 return (cache_fpl_aborted(fpl)); in cache_fplookup_trailingslash()
5431 return (cache_fpl_aborted(fpl)); in cache_fplookup_trailingslash()
5433 cache_fpl_smr_exit(fpl); in cache_fplookup_trailingslash()
5434 return (cache_fpl_handled_error(fpl, ENOTDIR)); in cache_fplookup_trailingslash()
5471 cache_fpl_pathlen_add(fpl, cn_nameptr_orig - cnp->cn_nameptr); in cache_fplookup_trailingslash()
5472 cache_fpl_checkpoint(fpl); in cache_fplookup_trailingslash()
5475 ni_pathlen = fpl->nulchar - cnp->cn_nameptr + 1; in cache_fplookup_trailingslash()
5476 if (ni_pathlen != fpl->debug.ni_pathlen) { in cache_fplookup_trailingslash()
5478 __func__, ni_pathlen, fpl->debug.ni_pathlen, fpl->nulchar, in cache_fplookup_trailingslash()
5493 tvp = fpl->tvp; in cache_fplookup_trailingslash()
5496 return (cache_fpl_aborted(fpl)); in cache_fplookup_trailingslash()
5500 return (cache_fpl_aborted(fpl)); in cache_fplookup_trailingslash()
5502 fpl->dvp = ncp->nc_dvp; in cache_fplookup_trailingslash()
5503 fpl->dvp_seqc = vn_seqc_read_any(fpl->dvp); in cache_fplookup_trailingslash()
5504 if (seqc_in_modify(fpl->dvp_seqc)) { in cache_fplookup_trailingslash()
5505 return (cache_fpl_aborted(fpl)); in cache_fplookup_trailingslash()
5514 cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error) in cache_fplookup_failed_vexec() argument
5520 cnp = fpl->cnp; in cache_fplookup_failed_vexec()
5521 dvp = fpl->dvp; in cache_fplookup_failed_vexec()
5522 dvp_seqc = fpl->dvp_seqc; in cache_fplookup_failed_vexec()
5530 if (cache_fpl_istrailingslash(fpl)) { in cache_fplookup_failed_vexec()
5531 return (cache_fpl_aborted(fpl)); in cache_fplookup_failed_vexec()
5537 if (cnp->cn_nameptr[0] == '\0' && fpl->tvp == NULL) { in cache_fplookup_failed_vexec()
5538 return (cache_fplookup_degenerate(fpl)); in cache_fplookup_failed_vexec()
5545 cache_fpl_smr_exit(fpl); in cache_fplookup_failed_vexec()
5546 return (cache_fpl_handled_error(fpl, ENAMETOOLONG)); in cache_fplookup_failed_vexec()
5582 if (fpl->fsearch) { in cache_fplookup_failed_vexec()
5583 return (cache_fpl_aborted(fpl)); in cache_fplookup_failed_vexec()
5589 error = cache_fpl_aborted(fpl); in cache_fplookup_failed_vexec()
5591 cache_fpl_partial(fpl); in cache_fplookup_failed_vexec()
5596 error = cache_fpl_aborted(fpl); in cache_fplookup_failed_vexec()
5598 cache_fpl_smr_exit(fpl); in cache_fplookup_failed_vexec()
5599 cache_fpl_handled_error(fpl, error); in cache_fplookup_failed_vexec()
5607 cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) in cache_fplookup_impl() argument
5614 ndp = fpl->ndp; in cache_fplookup_impl()
5615 cnp = fpl->cnp; in cache_fplookup_impl()
5617 cache_fpl_checkpoint(fpl); in cache_fplookup_impl()
5624 fpl->dvp = dvp; in cache_fplookup_impl()
5625 fpl->dvp_seqc = vn_seqc_read_notmodify(fpl->dvp); in cache_fplookup_impl()
5629 return (cache_fpl_aborted(fpl)); in cache_fplookup_impl()
5632 MPASS(fpl->tvp == NULL); in cache_fplookup_impl()
5635 cache_fplookup_parse(fpl); in cache_fplookup_impl()
5637 error = VOP_FPLOOKUP_VEXEC(fpl->dvp, cnp->cn_cred); in cache_fplookup_impl()
5639 error = cache_fplookup_failed_vexec(fpl, error); in cache_fplookup_impl()
5643 error = cache_fplookup_next(fpl); in cache_fplookup_impl()
5644 if (__predict_false(cache_fpl_terminated(fpl))) { in cache_fplookup_impl()
5648 VNPASS(!seqc_in_modify(fpl->tvp_seqc), fpl->tvp); in cache_fplookup_impl()
5650 if (fpl->tvp->v_type == VLNK) { in cache_fplookup_impl()
5651 error = cache_fplookup_symlink(fpl); in cache_fplookup_impl()
5652 if (cache_fpl_terminated(fpl)) { in cache_fplookup_impl()
5657 error = cache_fplookup_final(fpl); in cache_fplookup_impl()
5661 if (!vn_seqc_consistent(fpl->dvp, fpl->dvp_seqc)) { in cache_fplookup_impl()
5662 error = cache_fpl_aborted(fpl); in cache_fplookup_impl()
5666 fpl->dvp = fpl->tvp; in cache_fplookup_impl()
5667 fpl->dvp_seqc = fpl->tvp_seqc; in cache_fplookup_impl()
5668 cache_fplookup_parse_advance(fpl); in cache_fplookup_impl()
5671 cache_fpl_checkpoint(fpl); in cache_fplookup_impl()
5757 struct cache_fpl fpl; in cache_fplookup() local
5763 fpl.status = CACHE_FPL_STATUS_UNSET; in cache_fplookup()
5764 fpl.in_smr = false; in cache_fplookup()
5765 fpl.ndp = ndp; in cache_fplookup()
5766 fpl.cnp = cnp = &ndp->ni_cnd; in cache_fplookup()
5777 if (__predict_false(!cache_can_fplookup(&fpl))) { in cache_fplookup()
5778 *status = fpl.status; in cache_fplookup()
5779 SDT_PROBE3(vfs, fplookup, lookup, done, ndp, fpl.line, fpl.status); in cache_fplookup()
5783 cache_fpl_checkpoint_outer(&fpl); in cache_fplookup()
5785 cache_fpl_smr_enter_initial(&fpl); in cache_fplookup()
5787 fpl.debug.ni_pathlen = ndp->ni_pathlen; in cache_fplookup()
5789 fpl.nulchar = &cnp->cn_nameptr[ndp->ni_pathlen - 1]; in cache_fplookup()
5790 fpl.fsearch = false; in cache_fplookup()
5791 fpl.savename = (cnp->cn_flags & SAVENAME) != 0; in cache_fplookup()
5792 fpl.tvp = NULL; /* for degenerate path handling */ in cache_fplookup()
5793 fpl.pwd = pwdp; in cache_fplookup()
5795 *(fpl.pwd) = pwd; in cache_fplookup()
5800 dvp = cache_fpl_handle_root(&fpl); in cache_fplookup()
5807 error = cache_fplookup_dirfd(&fpl, &dvp); in cache_fplookup()
5815 error = cache_fplookup_impl(dvp, &fpl); in cache_fplookup()
5817 cache_fpl_smr_assert_not_entered(&fpl); in cache_fplookup()
5818 cache_fpl_assert_status(&fpl); in cache_fplookup()
5819 *status = fpl.status; in cache_fplookup()
5821 SDT_PROBE3(vfs, fplookup, lookup, done, ndp, fpl.line, fpl.status); in cache_fplookup()
5822 if (fpl.status == CACHE_FPL_STATUS_HANDLED) in cache_fplookup()
5827 if (__predict_true(fpl.status == CACHE_FPL_STATUS_HANDLED)) { in cache_fplookup()
5830 MPASS(fpl.dvp == NULL); in cache_fplookup()
5831 MPASS(fpl.tvp == NULL); in cache_fplookup()
5832 MPASS(fpl.savename == false); in cache_fplookup()
5834 ndp->ni_dvp = fpl.dvp; in cache_fplookup()
5835 ndp->ni_vp = fpl.tvp; in cache_fplookup()
5836 if (fpl.savename) { in cache_fplookup()