Lines Matching refs:dentry
23 static int get_name(const struct path *path, char *name, struct dentry *child);
26 static int exportfs_get_name(struct vfsmount *mnt, struct dentry *dir, in exportfs_get_name()
27 char *name, struct dentry *child) in exportfs_get_name()
30 struct path path = {.mnt = mnt, .dentry = dir}; in exportfs_get_name()
41 static struct dentry *
42 find_acceptable_alias(struct dentry *result, in find_acceptable_alias()
43 int (*acceptable)(void *context, struct dentry *dentry), in find_acceptable_alias() argument
46 struct dentry *dentry, *toput = NULL; in find_acceptable_alias() local
54 hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) { in find_acceptable_alias()
55 dget(dentry); in find_acceptable_alias()
59 if (dentry != result && acceptable(context, dentry)) { in find_acceptable_alias()
61 return dentry; in find_acceptable_alias()
64 toput = dentry; in find_acceptable_alias()
73 static bool dentry_connected(struct dentry *dentry) in dentry_connected() argument
75 dget(dentry); in dentry_connected()
76 while (dentry->d_flags & DCACHE_DISCONNECTED) { in dentry_connected()
77 struct dentry *parent = dget_parent(dentry); in dentry_connected()
79 dput(dentry); in dentry_connected()
80 if (IS_ROOT(dentry)) { in dentry_connected()
84 dentry = parent; in dentry_connected()
86 dput(dentry); in dentry_connected()
90 static void clear_disconnected(struct dentry *dentry) in clear_disconnected() argument
92 dget(dentry); in clear_disconnected()
93 while (dentry->d_flags & DCACHE_DISCONNECTED) { in clear_disconnected()
94 struct dentry *parent = dget_parent(dentry); in clear_disconnected()
96 WARN_ON_ONCE(IS_ROOT(dentry)); in clear_disconnected()
98 spin_lock(&dentry->d_lock); in clear_disconnected()
99 dentry->d_flags &= ~DCACHE_DISCONNECTED; in clear_disconnected()
100 spin_unlock(&dentry->d_lock); in clear_disconnected()
102 dput(dentry); in clear_disconnected()
103 dentry = parent; in clear_disconnected()
105 dput(dentry); in clear_disconnected()
120 static struct dentry *reconnect_one(struct vfsmount *mnt, in reconnect_one()
121 struct dentry *dentry, char *nbuf) in reconnect_one() argument
123 struct dentry *parent; in reconnect_one()
124 struct dentry *tmp; in reconnect_one()
128 inode_lock(dentry->d_inode); in reconnect_one()
130 parent = mnt->mnt_sb->s_export_op->get_parent(dentry); in reconnect_one()
131 inode_unlock(dentry->d_inode); in reconnect_one()
135 __func__, dentry->d_inode->i_ino, PTR_ERR(parent)); in reconnect_one()
140 dentry->d_inode->i_ino, parent->d_inode->i_ino); in reconnect_one()
141 err = exportfs_get_name(mnt, parent, nbuf, dentry); in reconnect_one()
152 if (tmp != dentry) { in reconnect_one()
163 if (IS_ROOT(dentry)) { in reconnect_one()
187 if (!dentry_connected(dentry)) in reconnect_one()
210 reconnect_path(struct vfsmount *mnt, struct dentry *target_dir, char *nbuf) in reconnect_path()
212 struct dentry *dentry, *parent; in reconnect_path() local
214 dentry = dget(target_dir); in reconnect_path()
216 while (dentry->d_flags & DCACHE_DISCONNECTED) { in reconnect_path()
217 BUG_ON(dentry == mnt->mnt_sb->s_root); in reconnect_path()
219 if (IS_ROOT(dentry)) in reconnect_path()
220 parent = reconnect_one(mnt, dentry, nbuf); in reconnect_path()
222 parent = dget_parent(dentry); in reconnect_path()
226 dput(dentry); in reconnect_path()
229 dentry = parent; in reconnect_path()
231 dput(dentry); in reconnect_path()
275 static int get_name(const struct path *path, char *name, struct dentry *child) in get_name()
278 struct inode *dir = path->dentry->d_inode; in get_name()
284 .dentry = child, in get_name()
395 int exportfs_encode_fh(struct dentry *dentry, struct fid *fid, int *max_len, in exportfs_encode_fh() argument
399 struct dentry *p = NULL; in exportfs_encode_fh()
400 struct inode *inode = dentry->d_inode, *parent = NULL; in exportfs_encode_fh()
403 p = dget_parent(dentry); in exportfs_encode_fh()
418 struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid, in exportfs_decode_fh()
420 int (*acceptable)(void *, struct dentry *), void *context) in exportfs_decode_fh() argument
423 struct dentry *result, *alias; in exportfs_decode_fh()
472 struct dentry *target_dir, *nresult; in exportfs_decode_fh()