Lines Matching refs:dentry

10 /* Check if a dentry can be expired */
11 static inline int autofs_can_expire(struct dentry *dentry,
14 struct autofs_info *ino = autofs_dentry_ino(dentry);
16 /* dentry in the process of being deleted */
30 struct dentry *dentry, unsigned int how)
32 struct dentry *top = dentry;
33 struct path path = {.mnt = mnt, .dentry = dentry};
36 pr_debug("dentry %p %pd\n", dentry, dentry);
43 if (is_autofs_dentry(path.dentry)) {
44 struct autofs_sb_info *sbi = autofs_sbi(path.dentry->d_sb);
74 static struct dentry *positive_after(struct dentry *p, struct dentry *child)
79 child = list_first_entry(&p->d_subdirs, struct dentry, d_child);
97 static struct dentry *get_next_positive_subdir(struct dentry *prev,
98 struct dentry *root)
101 struct dentry *q;
115 static struct dentry *get_next_positive_dentry(struct dentry *prev,
116 struct dentry *root)
119 struct dentry *p = prev, *ret = NULL, *d = NULL;
127 struct dentry *parent;
151 struct dentry *top,
171 /* Timeout of a direct mount is determined by its top dentry */
183 struct dentry *top,
188 struct dentry *p;
192 /* Negative dentry - give up */
198 pr_debug("dentry %p %pd\n", p, p);
203 * count for the autofs dentry.
234 /* Timeout of a tree mount is ultimately determined by its top dentry */
241 static struct dentry *autofs_check_leaves(struct vfsmount *mnt,
242 struct dentry *parent,
246 struct dentry *p;
252 pr_debug("dentry %p %pd\n", p, p);
274 static struct dentry *autofs_expire_direct(struct super_block *sb,
279 struct dentry *root = dget(sb->s_root);
316 /* Check if 'dentry' should expire, or return a nearby
317 * dentry that is suitable.
318 * If returned dentry is different from arg dentry,
321 static struct dentry *should_expire(struct dentry *dentry,
326 struct autofs_info *ino = autofs_dentry_ino(dentry);
339 if (d_mountpoint(dentry)) {
340 pr_debug("checking mountpoint %p %pd\n", dentry, dentry);
343 if (autofs_mount_busy(mnt, dentry, how))
350 return dentry;
353 if (autofs_can_expire(dentry, timeout, how))
354 return dentry;
358 if (d_really_is_positive(dentry) && d_is_symlink(dentry)) {
359 pr_debug("checking symlink %p %pd\n", dentry, dentry);
363 return dentry;
369 if (autofs_can_expire(dentry, timeout, how))
370 return dentry;
374 if (simple_empty(dentry))
381 /* ref-walk currently on this dentry? */
383 if (d_count(dentry) > ino_count)
387 if (!autofs_tree_busy(mnt, dentry, timeout, how))
388 return dentry;
394 struct dentry *expired;
398 /* ref-walk currently on this dentry? */
400 if (d_count(dentry) > ino_count)
404 expired = autofs_check_leaves(mnt, dentry, timeout, how);
406 if (expired == dentry)
407 dput(dentry);
420 static struct dentry *autofs_expire_indirect(struct super_block *sb,
426 struct dentry *root = sb->s_root;
427 struct dentry *dentry;
428 struct dentry *expired;
429 struct dentry *found;
437 dentry = NULL;
438 while ((dentry = get_next_positive_subdir(dentry, root))) {
440 ino = autofs_dentry_ino(dentry);
447 expired = should_expire(dentry, mnt, timeout, how);
467 if (expired != dentry)
468 dput(dentry);
476 if (expired != dentry)
491 struct dentry *dentry = path->dentry;
492 struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
493 struct autofs_info *ino = autofs_dentry_ino(dentry);
518 pr_debug("waiting for expire %p name=%pd\n", dentry, dentry);
525 if (d_unhashed(dentry))
543 struct dentry *dentry;
551 dentry = autofs_expire_indirect(sb, mnt, sbi, 0);
552 if (!dentry)
555 pkt.len = dentry->d_name.len;
556 memcpy(pkt.name, dentry->d_name.name, pkt.len);
563 ino = autofs_dentry_ino(dentry);
570 dput(dentry);
578 struct dentry *dentry;
582 dentry = autofs_expire_direct(sb, mnt, sbi, how);
584 dentry = autofs_expire_indirect(sb, mnt, sbi, how);
586 if (dentry) {
587 struct autofs_info *ino = autofs_dentry_ino(dentry);
588 const struct path path = { .mnt = mnt, .dentry = dentry };
601 dput(dentry);