Lines Matching refs:dentry
13 static int autofs_dir_symlink(struct inode *, struct dentry *, const char *);
14 static int autofs_dir_unlink(struct inode *, struct dentry *);
15 static int autofs_dir_rmdir(struct inode *, struct dentry *);
16 static int autofs_dir_mkdir(struct inode *, struct dentry *, umode_t);
23 static struct dentry *autofs_lookup(struct inode *,
24 struct dentry *, unsigned int);
27 static void autofs_dentry_release(struct dentry *);
63 static void autofs_del_active(struct dentry *dentry)
65 struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
68 ino = autofs_dentry_ino(dentry);
76 struct dentry *dentry = file->f_path.dentry;
77 struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
79 pr_debug("file=%p dentry=%p %pd\n", file, dentry, dentry);
94 if (!path_is_mountpoint(&file->f_path) && simple_empty(dentry)) {
104 static void autofs_dentry_release(struct dentry *de)
126 static struct dentry *autofs_lookup_active(struct dentry *dentry)
128 struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
129 struct dentry *parent = dentry->d_parent;
130 const struct qstr *name = &dentry->d_name;
142 struct dentry *active;
146 active = ino->dentry;
180 static struct dentry *autofs_lookup_expiring(struct dentry *dentry,
183 struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
184 struct dentry *parent = dentry->d_parent;
185 const struct qstr *name = &dentry->d_name;
197 struct dentry *expiring;
206 expiring = ino->dentry;
242 struct autofs_sb_info *sbi = autofs_sbi(path->dentry->d_sb);
243 struct autofs_info *ino = autofs_dentry_ino(path->dentry);
249 pr_debug("waiting for mount name=%pd\n", path->dentry);
262 struct dentry *dentry = path->dentry;
263 struct dentry *expiring;
265 expiring = autofs_lookup_expiring(dentry, rcu_walk);
271 const struct path this = { .mnt = path->mnt, .dentry = expiring };
284 static struct dentry *autofs_mountpoint_changed(struct path *path)
286 struct dentry *dentry = path->dentry;
287 struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
290 * If this is an indirect mount the dentry could have gone away
293 if (autofs_type_indirect(sbi->type) && d_unhashed(dentry)) {
294 struct dentry *parent = dentry->d_parent;
296 struct dentry *new;
298 new = d_lookup(parent, &dentry->d_name);
303 dput(path->dentry);
304 path->dentry = new;
306 return path->dentry;
311 struct dentry *dentry = path->dentry;
312 struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
313 struct autofs_info *ino = autofs_dentry_ino(dentry);
316 pr_debug("dentry=%p %pd\n", dentry, dentry);
345 * If the dentry is a symlink it's equivalent to a directory
349 if (d_really_is_positive(dentry) && d_is_symlink(dentry)) {
372 if (!simple_empty(dentry)) {
389 /* Mount succeeded, check if we ended up with a new dentry */
390 dentry = autofs_mountpoint_changed(path);
391 if (!dentry)
399 struct dentry *dentry = path->dentry;
400 struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
401 struct autofs_info *ino = autofs_dentry_ino(dentry);
404 pr_debug("dentry=%p %pd\n", dentry, dentry);
418 * This dentry may be under construction so wait on mount
439 inode = d_inode_rcu(dentry);
442 if (list_empty(&dentry->d_subdirs))
444 if (!simple_empty(dentry))
451 * If the dentry has been selected for expire while we slept
464 if ((!path_is_mountpoint(path) && !simple_empty(dentry)) ||
465 (d_really_is_positive(dentry) && d_is_symlink(dentry)))
474 static struct dentry *autofs_lookup(struct inode *dir,
475 struct dentry *dentry, unsigned int flags)
479 struct dentry *active;
481 pr_debug("name = %pd\n", dentry);
484 if (dentry->d_name.len > NAME_MAX)
494 active = autofs_lookup_active(dentry);
499 * A dentry that is not within the root can never trigger a
504 if (!autofs_oz_mode(sbi) && !IS_ROOT(dentry->d_parent))
512 spin_lock(&dentry->d_lock);
514 if (IS_ROOT(dentry->d_parent) &&
516 __managed_dentry_set_managed(dentry);
517 dentry->d_fsdata = ino;
518 ino->dentry = dentry;
522 spin_unlock(&dentry->d_lock);
528 struct dentry *dentry,
532 struct autofs_info *ino = autofs_dentry_ino(dentry);
538 pr_debug("%s <- %pd\n", symname, dentry);
554 autofs_del_active(dentry);
569 d_add(dentry, inode);
571 dget(dentry);
573 p_ino = autofs_dentry_ino(dentry->d_parent);
586 * VFS layer can turn the dentry into a negative dentry. We don't want
589 * which allows the dentry lookup to check for an incomplete expire.
591 * If a process is blocked on the dentry waiting for the expire to finish,
592 * it will invalidate the dentry and try to mount with a new one.
596 static int autofs_dir_unlink(struct inode *dir, struct dentry *dentry)
599 struct autofs_info *ino = autofs_dentry_ino(dentry);
613 p_ino = autofs_dentry_ino(dentry->d_parent);
615 dput(ino->dentry);
617 d_inode(dentry)->i_size = 0;
618 clear_nlink(d_inode(dentry));
623 __autofs_add_expiring(dentry);
624 d_drop(dentry);
641 static void autofs_set_leaf_automount_flags(struct dentry *dentry)
643 struct dentry *parent;
646 if (IS_ROOT(dentry->d_parent))
649 managed_dentry_set_managed(dentry);
651 parent = dentry->d_parent;
658 static void autofs_clear_leaf_automount_flags(struct dentry *dentry)
660 struct dentry *parent;
663 if (IS_ROOT(dentry->d_parent))
666 managed_dentry_clear_managed(dentry);
668 parent = dentry->d_parent;
676 static int autofs_dir_rmdir(struct inode *dir, struct dentry *dentry)
679 struct autofs_info *ino = autofs_dentry_ino(dentry);
682 pr_debug("dentry %p, removing %pd\n", dentry, dentry);
698 __autofs_add_expiring(dentry);
699 d_drop(dentry);
703 autofs_clear_leaf_automount_flags(dentry);
706 p_ino = autofs_dentry_ino(dentry->d_parent);
708 dput(ino->dentry);
709 d_inode(dentry)->i_size = 0;
710 clear_nlink(d_inode(dentry));
719 struct dentry *dentry, umode_t mode)
722 struct autofs_info *ino = autofs_dentry_ino(dentry);
736 pr_debug("dentry %p, creating %pd\n", dentry, dentry);
742 autofs_del_active(dentry);
747 d_add(dentry, inode);
750 autofs_set_leaf_automount_flags(dentry);
752 dget(dentry);
754 p_ino = autofs_dentry_ino(dentry->d_parent);
845 * an extra dentry refcount or not. We only hold a refcount on the
846 * dentry if its non-negative (ie, d_inode != NULL)
848 int is_autofs_dentry(struct dentry *dentry)
850 return dentry && d_really_is_positive(dentry) &&
851 dentry->d_op == &autofs_dentry_operations &&
852 dentry->d_fsdata != NULL;