-
-static int ll_fini_revalidate_nd(struct dentry *dentry, struct nameidata *nd)
-{
- ENTRY;
- /* need lookup */
- RETURN(0);
-}
-
-struct dentry_operations ll_fini_d_ops = {
- .d_revalidate = ll_fini_revalidate_nd,
- .d_release = ll_release,
-};
-
-/*
- * It is for the following race condition:
- * When someone (maybe statahead thread) adds the dentry to the dentry hash
- * table, the dentry's "d_op" maybe NULL, at the same time, another (maybe
- * "ls -l") process finds such dentry by "do_lookup()" without "do_revalidate()"
- * called. It causes statahead window lost, and maybe other issues. --Fan Yong
- */
-static int ll_init_revalidate_nd(struct dentry *dentry, struct nameidata *nd)
-{
- struct l_wait_info lwi = { 0 };
- struct ll_dentry_data *lld;
- ENTRY;
-
- ll_set_dd(dentry);
- lld = ll_d2d(dentry);
- if (unlikely(lld == NULL))
- RETURN(-ENOMEM);
-
- l_wait_event(lld->lld_waitq, dentry->d_op != &ll_init_d_ops, &lwi);
- if (likely(dentry->d_op == &ll_d_ops))
- RETURN(ll_revalidate_nd(dentry, nd));
- else
- RETURN(dentry->d_op == &ll_fini_d_ops ? 0 : -EINVAL);
-}
-
-struct dentry_operations ll_init_d_ops = {
- .d_revalidate = ll_init_revalidate_nd,
- .d_release = ll_release,
-};