Lines Matching refs:dentry

116 static inline struct hlist_head *m_hash(struct vfsmount *mnt, struct dentry *dentry)
119 tmp += ((unsigned long)dentry / L1_CACHE_BYTES);
124 static inline struct hlist_head *mp_hash(struct dentry *dentry)
126 unsigned long tmp = ((unsigned long)dentry / L1_CACHE_BYTES);
678 * @dentry: mountpoint
680 * If @mnt has a child mount @c mounted @dentry find and return it.
691 * on @dentry.
693 * Return: The first child of @mnt mounted @dentry or NULL.
695 struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry)
697 struct hlist_head *head = m_hash(mnt, dentry);
701 if (&p->mnt_parent->mnt == mnt && p->mnt_mountpoint == dentry)
716 * Then lookup_mnt() on the base /mnt dentry in the root mount will
717 * return successively the root dentry and vfsmount of /dev/sda1, then
731 child_mnt = __lookup_mnt(path->mnt, path->dentry);
739 * __is_local_mountpoint - Test to see if dentry is a mountpoint in the
745 * mounts in the current mount namespace and test to see if the dentry
753 bool __is_local_mountpoint(struct dentry *dentry)
761 is_covered = (mnt->mnt_mountpoint == dentry);
770 static struct mountpoint *lookup_mountpoint(struct dentry *dentry)
772 struct hlist_head *chain = mp_hash(dentry);
776 if (mp->m_dentry == dentry) {
784 static struct mountpoint *get_mountpoint(struct dentry *dentry)
789 if (d_mountpoint(dentry)) {
791 if (d_unlinked(dentry))
795 mp = lookup_mountpoint(dentry);
808 ret = d_set_mounted(dentry);
814 /* The dentry is not available as a mountpoint? */
821 new->m_dentry = dget(dentry);
823 hlist_add_head(&new->m_hash, mp_hash(dentry));
841 struct dentry *dentry = mp->m_dentry;
843 spin_lock(&dentry->d_lock);
844 dentry->d_flags &= ~DCACHE_MOUNTED;
845 spin_unlock(&dentry->d_lock);
846 dput_to_list(dentry, list);
1165 vfs_submount(const struct dentry *mountpoint, struct file_system_type *type,
1179 static struct mount *clone_mnt(struct mount *old, struct dentry *root,
1391 * d_mountpoint() can only be used reliably to establish if a dentry is
1394 * mounts using a given dentry in a different namespace. This function
1395 * checks if the passed in path is a mountpoint rather than the dentry
1403 if (!d_mountpoint(path->dentry))
1420 p = clone_mnt(real_mount(path->mnt), path->dentry, CL_PRIVATE);
1806 * __detach_mounts - lazily unmount all mounts on the specified dentry
1813 * The caller may hold dentry->d_inode->i_mutex.
1815 void __detach_mounts(struct dentry *dentry)
1822 mp = lookup_mountpoint(dentry);
1859 return path->mnt->mnt_root == path->dentry;
1899 dput(path->dentry);
1939 static bool is_mnt_ns_file(struct dentry *dentry)
1942 return dentry->d_op == &ns_dentry_operations &&
1943 dentry->d_fsdata == &mntns_operations;
1956 static bool mnt_ns_loop(struct dentry *dentry)
1962 if (!is_mnt_ns_file(dentry))
1965 mnt_ns = to_mnt_ns(get_proc_ns(dentry->d_inode));
1969 struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
1977 if (!(flag & CL_COPY_MNT_NS_FILE) && is_mnt_ns_file(dentry))
1980 res = q = clone_mnt(mnt, dentry, flag);
1989 if (!is_subdir(r->mnt_mountpoint, dentry))
2043 tree = copy_tree(real_mount(path->mnt), path->dentry,
2081 static bool has_locked_children(struct mount *mnt, struct dentry *dentry)
2086 if (!is_subdir(child->mnt_mountpoint, dentry))
2117 if (has_locked_children(old_mnt, path->dentry))
2120 new_mnt = clone_mnt(old_mnt, path->dentry, CL_PRIVATE);
2414 * the initial @path->{mnt,dentry} is a mountpoint lookup the first
2445 struct dentry *dentry;
2454 dentry = dget(m->mnt_mountpoint);
2457 dentry = path->dentry;
2460 inode_lock(dentry->d_inode);
2461 if (unlikely(cant_mount(dentry))) {
2462 inode_unlock(dentry->d_inode);
2468 if (beneath && (!is_mounted(mnt) || m->mnt_mountpoint != dentry)) {
2470 inode_unlock(dentry->d_inode);
2479 inode_unlock(dentry->d_inode);
2481 dput(dentry);
2484 path->dentry = dget(mnt->mnt_root);
2487 mp = get_mountpoint(dentry);
2490 inode_unlock(dentry->d_inode);
2495 dput(dentry);
2507 struct dentry *dentry = where->m_dentry;
2514 inode_unlock(dentry->d_inode);
2588 if (!check_mnt(old) && old_path->dentry->d_op != &ns_dentry_operations)
2591 if (!recurse && has_locked_children(old, old_path->dentry))
2595 mnt = copy_tree(old, old_path->dentry, CL_COPY_MNT_NS_FILE);
2597 mnt = clone_mnt(old, old_path->dentry, 0);
2622 if (mnt_ns_loop(old_path.dentry))
2877 fc = fs_context_for_reconfigure(path->dentry, sb_flags, MS_RMT_MASK);
3017 * @path->mnt with @path->dentry as mountpoint.
3025 if (unlikely(__lookup_mnt(path->mnt, path->dentry))) {
3039 * - Make sure that @to->dentry is actually the root of a mount under
3159 if (d_is_dir(new_path->dentry) !=
3160 d_is_dir(old_path->dentry))
3362 struct dentry *dentry = path->dentry;
3379 m->mnt_root == dentry) {
3389 inode_lock(dentry->d_inode);
3391 if (unlikely(cant_mount(dentry))) {
3399 mp = get_mountpoint(dentry);
3414 inode_unlock(dentry->d_inode);
3839 struct dentry *mount_subtree(struct vfsmount *m, const char *name)
3871 return path.dentry;
4016 newmount.dentry = dget(fc->root);
4134 bool is_path_reachable(struct mount *mnt, struct dentry *dentry,
4138 dentry = mnt->mnt_mountpoint;
4141 return &mnt->mnt == root->mnt && is_subdir(dentry, root->dentry);
4148 res = is_path_reachable(real_mount(path1->mnt), path1->dentry, path2);
4225 if (d_unlinked(new.dentry))
4240 if (!is_path_reachable(old_mnt, old.dentry, &new))
4243 if (!is_path_reachable(new_mnt, new.dentry, &root))
4695 int show_path(struct seq_file *m, struct dentry *root)
4831 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
5061 if (!is_path_reachable(real_mount(orig->mnt), orig->dentry, root) &&
5065 ret = security_sb_statfs(orig->dentry);
5118 orig.dentry = orig.mnt->mnt_root;
5155 root.dentry = mnt->mnt_root;
5257 ns_root.dentry = ns_root.mnt->mnt_root;
5259 while (d_mountpoint(ns_root.dentry) && follow_down_one(&ns_root))