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);
615 * find the first mount at @dentry on vfsmount @mnt.
618 struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry)
620 struct hlist_head *head = m_hash(mnt, dentry);
624 if (&p->mnt_parent->mnt == mnt && p->mnt_mountpoint == dentry)
630 * find the last mount at @dentry on vfsmount @mnt.
633 struct mount *__lookup_mnt_last(struct vfsmount *mnt, struct dentry *dentry)
636 p = __lookup_mnt(mnt, dentry);
642 if (&p->mnt_parent->mnt != mnt || p->mnt_mountpoint != dentry)
661 * Then lookup_mnt() on the base /mnt dentry in the root mount will
662 * return successively the root dentry and vfsmount of /dev/sda1, then
676 child_mnt = __lookup_mnt(path->mnt, path->dentry);
684 * __is_local_mountpoint - Test to see if dentry is a mountpoint in the
690 * mounts in the current mount namespace and test to see if the dentry
698 bool __is_local_mountpoint(struct dentry *dentry)
704 if (!d_mountpoint(dentry))
709 is_covered = (mnt->mnt_mountpoint == dentry);
718 static struct mountpoint *lookup_mountpoint(struct dentry *dentry)
720 struct hlist_head *chain = mp_hash(dentry);
724 if (mp->m_dentry == dentry) {
726 if (d_unlinked(dentry))
735 static struct mountpoint *new_mountpoint(struct dentry *dentry)
737 struct hlist_head *chain = mp_hash(dentry);
745 ret = d_set_mounted(dentry);
751 mp->m_dentry = dentry;
761 struct dentry *dentry = mp->m_dentry;
763 spin_lock(&dentry->d_lock);
764 dentry->d_flags &= ~DCACHE_MOUNTED;
765 spin_unlock(&dentry->d_lock);
817 old_path->dentry = mnt->mnt_mountpoint;
925 struct dentry *root;
955 static struct mount *clone_mnt(struct mount *old, struct dentry *root,
1148 p = clone_mnt(real_mount(path->mnt), path->dentry, CL_PRIVATE);
1166 int generic_show_options(struct seq_file *m, struct dentry *root)
1534 * __detach_mounts - lazily unmount all mounts on the specified dentry
1541 * The caller may hold dentry->d_inode->i_mutex.
1543 void __detach_mounts(struct dentry *dentry)
1549 mp = lookup_mountpoint(dentry);
1605 if (path.dentry != path.mnt->mnt_root)
1618 dput(path.dentry);
1636 static bool is_mnt_ns_file(struct dentry *dentry)
1639 return dentry->d_op == &ns_dentry_operations &&
1640 dentry->d_fsdata == &mntns_operations;
1648 static bool mnt_ns_loop(struct dentry *dentry)
1654 if (!is_mnt_ns_file(dentry))
1657 mnt_ns = to_mnt_ns(get_proc_ns(dentry->d_inode));
1661 struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
1669 if (!(flag & CL_COPY_MNT_NS_FILE) && is_mnt_ns_file(dentry))
1672 res = q = clone_mnt(mnt, dentry, flag);
1681 if (!is_subdir(r->mnt_mountpoint, dentry))
1737 tree = copy_tree(real_mount(path->mnt), path->dentry,
1772 new_mnt = clone_mnt(old_mnt, path->dentry, CL_PRIVATE);
1827 * store the parent mount and mountpoint dentry.
1943 struct dentry *dentry = path->dentry;
1945 mutex_lock(&dentry->d_inode->i_mutex);
1946 if (unlikely(cant_mount(dentry))) {
1947 mutex_unlock(&dentry->d_inode->i_mutex);
1953 struct mountpoint *mp = lookup_mountpoint(dentry);
1955 mp = new_mountpoint(dentry);
1958 mutex_unlock(&dentry->d_inode->i_mutex);
1964 mutex_unlock(&path->dentry->d_inode->i_mutex);
1967 dentry = path->dentry = dget(mnt->mnt_root);
1973 struct dentry *dentry = where->m_dentry;
1976 mutex_unlock(&dentry->d_inode->i_mutex);
2019 if (path->dentry != path->mnt->mnt_root)
2043 static bool has_locked_children(struct mount *mnt, struct dentry *dentry)
2047 if (!is_subdir(child->mnt_mountpoint, dentry))
2073 if (mnt_ns_loop(old_path.dentry))
2091 if (!check_mnt(old) && old_path.dentry->d_op != &ns_dentry_operations)
2094 if (!recurse && has_locked_children(old, old_path.dentry))
2098 mnt = copy_tree(old, old_path.dentry, CL_COPY_MNT_NS_FILE);
2100 mnt = clone_mnt(old, old_path.dentry, 0);
2154 if (path->dentry != path->mnt->mnt_root)
2251 if (old_path.dentry != old_path.mnt->mnt_root)
2257 if (d_is_dir(path->dentry) !=
2258 d_is_dir(old_path.dentry))
2344 path->mnt->mnt_root == path->dentry)
2425 m->mnt_root == path->dentry) {
2854 struct dentry *mount_subtree(struct vfsmount *mnt, const char *name)
2880 return path.dentry;
2923 bool is_path_reachable(struct mount *mnt, struct dentry *dentry,
2927 dentry = mnt->mnt_mountpoint;
2930 return &mnt->mnt == root->mnt && is_subdir(dentry, root->dentry);
2937 res = is_path_reachable(real_mount(path1->mnt), path1->dentry, path2);
3010 if (d_unlinked(new.dentry))
3016 if (root.mnt->mnt_root != root.dentry)
3021 if (new.mnt->mnt_root != new.dentry)
3026 if (!is_path_reachable(old_mnt, old.dentry, &new))
3029 if (!is_path_reachable(new_mnt, new.dentry, &root))
3089 root.dentry = mnt->mnt_root;
3184 ns_root.dentry = ns_root.mnt->mnt_root;
3186 while (d_mountpoint(ns_root.dentry) && follow_down_one(&ns_root))
3301 root.dentry = mnt_ns->root->mnt.mnt_root;
3303 while(d_mountpoint(root.dentry) && follow_down_one(&root))