Lines Matching defs:dentry
81 static inline struct hlist_head *m_hash(struct vfsmount *mnt, struct dentry *dentry)
84 tmp += ((unsigned long)dentry / L1_CACHE_BYTES);
89 static inline struct hlist_head *mp_hash(struct dentry *dentry)
91 unsigned long tmp = ((unsigned long)dentry / L1_CACHE_BYTES);
626 * find the first mount at @dentry on vfsmount @mnt.
629 struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry)
631 struct hlist_head *head = m_hash(mnt, dentry);
635 if (&p->mnt_parent->mnt == mnt && p->mnt_mountpoint == dentry)
641 * find the last mount at @dentry on vfsmount @mnt.
644 struct mount *__lookup_mnt_last(struct vfsmount *mnt, struct dentry *dentry)
647 p = __lookup_mnt(mnt, dentry);
653 if (&p->mnt_parent->mnt != mnt || p->mnt_mountpoint != dentry)
672 * Then lookup_mnt() on the base /mnt dentry in the root mount will
673 * return successively the root dentry and vfsmount of /dev/sda1, then
687 child_mnt = __lookup_mnt(path->mnt, path->dentry);
695 * __is_local_mountpoint - Test to see if dentry is a mountpoint in the
701 * mounts in the current mount namespace and test to see if the dentry
709 bool __is_local_mountpoint(struct dentry *dentry)
715 if (!d_mountpoint(dentry))
720 is_covered = (mnt->mnt_mountpoint == dentry);
729 static struct mountpoint *lookup_mountpoint(struct dentry *dentry)
731 struct hlist_head *chain = mp_hash(dentry);
735 if (mp->m_dentry == dentry) {
737 if (d_unlinked(dentry))
746 static struct mountpoint *new_mountpoint(struct dentry *dentry)
748 struct hlist_head *chain = mp_hash(dentry);
756 ret = d_set_mounted(dentry);
762 mp->m_dentry = dentry;
772 struct dentry *dentry = mp->m_dentry;
774 spin_lock(&dentry->d_lock);
775 dentry->d_flags &= ~DCACHE_MOUNTED;
776 spin_unlock(&dentry->d_lock);
828 old_path->dentry = mnt->mnt_mountpoint;
936 struct dentry *root;
966 static struct mount *clone_mnt(struct mount *old, struct dentry *root,
1159 p = clone_mnt(real_mount(path->mnt), path->dentry, CL_PRIVATE);
1177 int generic_show_options(struct seq_file *m, struct dentry *root)
1545 * __detach_mounts - lazily unmount all mounts on the specified dentry
1552 * The caller may hold dentry->d_inode->i_mutex.
1554 void __detach_mounts(struct dentry *dentry)
1560 mp = lookup_mountpoint(dentry);
1616 if (path.dentry != path.mnt->mnt_root)
1629 dput(path.dentry);
1647 static bool is_mnt_ns_file(struct dentry *dentry)
1650 return dentry->d_op == &ns_dentry_operations &&
1651 dentry->d_fsdata == &mntns_operations;
1659 static bool mnt_ns_loop(struct dentry *dentry)
1665 if (!is_mnt_ns_file(dentry))
1668 mnt_ns = to_mnt_ns(get_proc_ns(dentry->d_inode));
1672 struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
1680 if (!(flag & CL_COPY_MNT_NS_FILE) && is_mnt_ns_file(dentry))
1683 res = q = clone_mnt(mnt, dentry, flag);
1692 if (!is_subdir(r->mnt_mountpoint, dentry))
1748 tree = copy_tree(real_mount(path->mnt), path->dentry,
1783 new_mnt = clone_mnt(old_mnt, path->dentry, CL_PRIVATE);
1838 * store the parent mount and mountpoint dentry.
1954 struct dentry *dentry = path->dentry;
1956 mutex_lock(&dentry->d_inode->i_mutex);
1957 if (unlikely(cant_mount(dentry))) {
1958 mutex_unlock(&dentry->d_inode->i_mutex);
1964 struct mountpoint *mp = lookup_mountpoint(dentry);
1966 mp = new_mountpoint(dentry);
1969 mutex_unlock(&dentry->d_inode->i_mutex);
1975 mutex_unlock(&path->dentry->d_inode->i_mutex);
1978 dentry = path->dentry = dget(mnt->mnt_root);
1984 struct dentry *dentry = where->m_dentry;
1987 mutex_unlock(&dentry->d_inode->i_mutex);
2030 if (path->dentry != path->mnt->mnt_root)
2054 static bool has_locked_children(struct mount *mnt, struct dentry *dentry)
2058 if (!is_subdir(child->mnt_mountpoint, dentry))
2084 if (mnt_ns_loop(old_path.dentry))
2102 if (!check_mnt(old) && old_path.dentry->d_op != &ns_dentry_operations)
2105 if (!recurse && has_locked_children(old, old_path.dentry))
2109 mnt = copy_tree(old, old_path.dentry, CL_COPY_MNT_NS_FILE);
2111 mnt = clone_mnt(old, old_path.dentry, 0);
2165 if (path->dentry != path->mnt->mnt_root)
2262 if (old_path.dentry != old_path.mnt->mnt_root)
2268 if (d_is_dir(path->dentry) !=
2269 d_is_dir(old_path.dentry))
2355 path->mnt->mnt_root == path->dentry)
2434 m->mnt_root == path->dentry) {
2863 struct dentry *mount_subtree(struct vfsmount *mnt, const char *name)
2889 return path.dentry;
2932 bool is_path_reachable(struct mount *mnt, struct dentry *dentry,
2936 dentry = mnt->mnt_mountpoint;
2939 return &mnt->mnt == root->mnt && is_subdir(dentry, root->dentry);
2946 res = is_path_reachable(real_mount(path1->mnt), path1->dentry, path2);
3019 if (d_unlinked(new.dentry))
3025 if (root.mnt->mnt_root != root.dentry)
3030 if (new.mnt->mnt_root != new.dentry)
3035 if (!is_path_reachable(old_mnt, old.dentry, &new))
3038 if (!is_path_reachable(new_mnt, new.dentry, &root))
3098 root.dentry = mnt->mnt_root;
3193 ns_root.dentry = ns_root.mnt->mnt_root;
3195 while (d_mountpoint(ns_root.dentry) && follow_down_one(&ns_root))
3327 root.dentry = mnt_ns->root->mnt.mnt_root;
3329 while(d_mountpoint(root.dentry) && follow_down_one(&root))