Lines Matching refs:dentry

546 	dget(path->dentry);  in path_get()
558 dput(path->dentry); in path_put()
600 p->path.dentry = NULL; in __set_nameidata()
647 static bool path_connected(struct vfsmount *mnt, struct dentry *dentry) in path_connected() argument
655 return is_subdir(dentry, mnt->mnt_root); in path_connected()
692 nd->path.dentry = NULL; in terminate_walk()
702 path->dentry = NULL; in __legitimize_path()
705 if (unlikely(!lockref_get_not_dead(&path->dentry->d_lockref))) { in __legitimize_path()
706 path->dentry = NULL; in __legitimize_path()
709 return !read_seqcount_retry(&path->dentry->d_seq, seq); in __legitimize_path()
770 struct dentry *parent = nd->path.dentry; in try_to_unlazy()
786 nd->path.dentry = NULL; in try_to_unlazy()
804 static bool try_to_unlazy_next(struct nameidata *nd, struct dentry *dentry) in try_to_unlazy_next() argument
817 if (unlikely(!lockref_get_not_dead(&nd->path.dentry->d_lockref))) in try_to_unlazy_next()
827 if (unlikely(!lockref_get_not_dead(&dentry->d_lockref))) in try_to_unlazy_next()
829 if (read_seqcount_retry(&dentry->d_seq, nd->next_seq)) in try_to_unlazy_next()
843 nd->path.dentry = NULL; in try_to_unlazy_next()
849 dput(dentry); in try_to_unlazy_next()
853 static inline int d_revalidate(struct dentry *dentry, unsigned int flags) in d_revalidate() argument
855 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) in d_revalidate()
856 return dentry->d_op->d_revalidate(dentry, flags); in d_revalidate()
873 struct dentry *dentry = nd->path.dentry; in complete_walk() local
913 if (likely(!(dentry->d_flags & DCACHE_OP_WEAK_REVALIDATE))) in complete_walk()
916 status = dentry->d_op->d_weak_revalidate(dentry, nd->flags); in complete_walk()
944 nd->root_seq = __read_seqcount_begin(&nd->root.dentry->d_seq); in set_root()
968 struct dentry *d; in nd_jump_root()
970 d = nd->path.dentry; in nd_jump_root()
979 nd->inode = nd->path.dentry->d_inode; in nd_jump_root()
1008 nd->inode = nd->path.dentry->d_inode; in nd_jump_link()
1120 audit_inode(nd->name, nd->stack[0].link.dentry, 0); in may_follow_link()
1183 struct inode *inode = link->dentry->d_inode; in may_linkat()
1271 struct dentry *mountpoint; in follow_up()
1282 dput(path->dentry); in follow_up()
1283 path->dentry = mountpoint; in follow_up()
1294 struct dentry *mountpoint = m->mnt_mountpoint; in choose_mountpoint_rcu()
1297 if (unlikely(root->dentry == mountpoint && in choose_mountpoint_rcu()
1302 path->dentry = mountpoint; in choose_mountpoint_rcu()
1342 struct dentry *dentry = path->dentry; in follow_automount() local
1357 dentry->d_inode) in follow_automount()
1363 return finish_automount(dentry->d_op->d_automount(path), path); in follow_automount()
1383 ret = path->dentry->d_op->d_manage(path, false); in __traverse_mounts()
1384 flags = smp_load_acquire(&path->dentry->d_flags); in __traverse_mounts()
1392 dput(path->dentry); in __traverse_mounts()
1396 path->dentry = dget(mounted->mnt_root); in __traverse_mounts()
1398 flags = path->dentry->d_flags; in __traverse_mounts()
1409 flags = smp_load_acquire(&path->dentry->d_flags); in __traverse_mounts()
1428 unsigned flags = smp_load_acquire(&path->dentry->d_flags); in traverse_mounts()
1446 dput(path->dentry); in follow_down_one()
1449 path->dentry = dget(mounted->mnt_root); in follow_down_one()
1479 struct dentry *dentry = path->dentry; in __follow_mount_rcu() local
1480 unsigned int flags = dentry->d_flags; in __follow_mount_rcu()
1494 int res = dentry->d_op->d_manage(path, true); in __follow_mount_rcu()
1497 flags = dentry->d_flags; in __follow_mount_rcu()
1501 struct mount *mounted = __lookup_mnt(path->mnt, dentry); in __follow_mount_rcu()
1504 dentry = path->dentry = mounted->mnt.mnt_root; in __follow_mount_rcu()
1506 nd->next_seq = read_seqcount_begin(&dentry->d_seq); in __follow_mount_rcu()
1507 flags = dentry->d_flags; in __follow_mount_rcu()
1521 static inline int handle_mounts(struct nameidata *nd, struct dentry *dentry, in handle_mounts() argument
1528 path->dentry = dentry; in handle_mounts()
1535 path->dentry = dentry; in handle_mounts()
1537 if (!try_to_unlazy_next(nd, dentry)) in handle_mounts()
1548 dput(path->dentry); in handle_mounts()
1559 static struct dentry *lookup_dcache(const struct qstr *name, in lookup_dcache()
1560 struct dentry *dir, in lookup_dcache()
1563 struct dentry *dentry = d_lookup(dir, name); in lookup_dcache() local
1564 if (dentry) { in lookup_dcache()
1565 int error = d_revalidate(dentry, flags); in lookup_dcache()
1568 d_invalidate(dentry); in lookup_dcache()
1569 dput(dentry); in lookup_dcache()
1573 return dentry; in lookup_dcache()
1583 static struct dentry *__lookup_hash(const struct qstr *name, in __lookup_hash()
1584 struct dentry *base, unsigned int flags) in __lookup_hash()
1586 struct dentry *dentry = lookup_dcache(name, base, flags); in __lookup_hash() local
1587 struct dentry *old; in __lookup_hash()
1590 if (dentry) in __lookup_hash()
1591 return dentry; in __lookup_hash()
1597 dentry = d_alloc(base, name); in __lookup_hash()
1598 if (unlikely(!dentry)) in __lookup_hash()
1601 old = dir->i_op->lookup(dir, dentry, flags); in __lookup_hash()
1603 dput(dentry); in __lookup_hash()
1604 dentry = old; in __lookup_hash()
1606 return dentry; in __lookup_hash()
1609 static struct dentry *lookup_fast(struct nameidata *nd) in lookup_fast()
1611 struct dentry *dentry, *parent = nd->path.dentry; in lookup_fast() local
1620 dentry = __d_lookup_rcu(parent, &nd->last, &nd->next_seq); in lookup_fast()
1621 if (unlikely(!dentry)) { in lookup_fast()
1634 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1636 return dentry; in lookup_fast()
1637 if (!try_to_unlazy_next(nd, dentry)) in lookup_fast()
1641 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1643 dentry = __d_lookup(parent, &nd->last); in lookup_fast()
1644 if (unlikely(!dentry)) in lookup_fast()
1646 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1650 d_invalidate(dentry); in lookup_fast()
1651 dput(dentry); in lookup_fast()
1654 return dentry; in lookup_fast()
1658 static struct dentry *__lookup_slow(const struct qstr *name, in __lookup_slow()
1659 struct dentry *dir, in __lookup_slow()
1662 struct dentry *dentry, *old; in __lookup_slow() local
1670 dentry = d_alloc_parallel(dir, name, &wq); in __lookup_slow()
1671 if (IS_ERR(dentry)) in __lookup_slow()
1672 return dentry; in __lookup_slow()
1673 if (unlikely(!d_in_lookup(dentry))) { in __lookup_slow()
1674 int error = d_revalidate(dentry, flags); in __lookup_slow()
1677 d_invalidate(dentry); in __lookup_slow()
1678 dput(dentry); in __lookup_slow()
1681 dput(dentry); in __lookup_slow()
1682 dentry = ERR_PTR(error); in __lookup_slow()
1685 old = inode->i_op->lookup(inode, dentry, flags); in __lookup_slow()
1686 d_lookup_done(dentry); in __lookup_slow()
1688 dput(dentry); in __lookup_slow()
1689 dentry = old; in __lookup_slow()
1692 return dentry; in __lookup_slow()
1695 static struct dentry *lookup_slow(const struct qstr *name, in lookup_slow()
1696 struct dentry *dir, in lookup_slow()
1700 struct dentry *res; in lookup_slow()
1782 error = security_inode_follow_link(link->dentry, inode, in pick_link()
1789 const char * (*get)(struct dentry *, struct inode *, in pick_link()
1795 res = get(link->dentry, inode, &last->done); in pick_link()
1797 res = get(link->dentry, inode, &last->done); in pick_link()
1827 struct dentry *dentry) in step_into() argument
1831 int err = handle_mounts(nd, dentry, &path); in step_into()
1835 inode = path.dentry->d_inode; in step_into()
1836 if (likely(!d_is_symlink(path.dentry)) || in step_into()
1841 if (read_seqcount_retry(&path.dentry->d_seq, nd->next_seq)) in step_into()
1846 dput(nd->path.dentry); in step_into()
1857 if (read_seqcount_retry(&path.dentry->d_seq, nd->next_seq)) in step_into()
1866 static struct dentry *follow_dotdot_rcu(struct nameidata *nd) in follow_dotdot_rcu()
1868 struct dentry *parent, *old; in follow_dotdot_rcu()
1872 if (unlikely(nd->path.dentry == nd->path.mnt->mnt_root)) { in follow_dotdot_rcu()
1881 nd->inode = path.dentry->d_inode; in follow_dotdot_rcu()
1888 old = nd->path.dentry; in follow_dotdot_rcu()
1903 return nd->path.dentry; in follow_dotdot_rcu()
1906 static struct dentry *follow_dotdot(struct nameidata *nd) in follow_dotdot()
1908 struct dentry *parent; in follow_dotdot()
1912 if (unlikely(nd->path.dentry == nd->path.mnt->mnt_root)) { in follow_dotdot()
1920 nd->inode = path.dentry->d_inode; in follow_dotdot()
1925 parent = dget_parent(nd->path.dentry); in follow_dotdot()
1935 return dget(nd->path.dentry); in follow_dotdot()
1942 struct dentry *parent; in handle_dots()
1978 struct dentry *dentry; in walk_component() local
1989 dentry = lookup_fast(nd); in walk_component()
1990 if (IS_ERR(dentry)) in walk_component()
1991 return ERR_CAST(dentry); in walk_component()
1992 if (unlikely(!dentry)) { in walk_component()
1993 dentry = lookup_slow(&nd->last, nd->path.dentry, nd->flags); in walk_component()
1994 if (IS_ERR(dentry)) in walk_component()
1995 return ERR_CAST(dentry); in walk_component()
1999 return step_into(nd, flags, dentry); in walk_component()
2266 hash_len = hash_name(nd->path.dentry, name); in link_path_walk()
2280 struct dentry *parent = nd->path.dentry; in link_path_walk()
2330 if (unlikely(!d_can_lookup(nd->path.dentry))) { in link_path_walk()
2365 struct dentry *root = nd->root.dentry; in path_init()
2372 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
2399 nd->inode = nd->path.dentry->d_inode; in path_init()
2400 nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
2404 nd->inode = nd->path.dentry->d_inode; in path_init()
2409 struct dentry *dentry; in path_init() local
2414 dentry = f.file->f_path.dentry; in path_init()
2416 if (*s && unlikely(!d_can_lookup(dentry))) { in path_init()
2423 nd->inode = nd->path.dentry->d_inode; in path_init()
2424 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
2427 nd->inode = nd->path.dentry->d_inode; in path_init()
2456 dget(nd->path.dentry); in handle_lookup_down()
2458 return PTR_ERR(step_into(nd, WALK_NOFOLLOW, nd->path.dentry)); in handle_lookup_down()
2484 if (!d_can_lookup(nd->path.dentry)) in path_lookupat()
2489 nd->path.dentry = NULL; in path_lookupat()
2510 audit_inode(name, path->dentry, in filename_lookup()
2527 nd->path.dentry = NULL; in path_parentat()
2552 audit_inode(name, parent->dentry, AUDIT_INODE_PARENT); in filename_parentat()
2559 static struct dentry *__kern_path_locked(struct filename *name, struct path *path) in __kern_path_locked()
2561 struct dentry *d; in __kern_path_locked()
2572 inode_lock_nested(path->dentry->d_inode, I_MUTEX_PARENT); in __kern_path_locked()
2573 d = __lookup_hash(&last, path->dentry, 0); in __kern_path_locked()
2575 inode_unlock(path->dentry->d_inode); in __kern_path_locked()
2581 struct dentry *kern_path_locked(const char *name, struct path *path) in kern_path_locked()
2584 struct dentry *res = __kern_path_locked(filename, path); in kern_path_locked()
2609 int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, in vfs_path_lookup() argument
2614 struct path root = {.mnt = mnt, .dentry = dentry}; in vfs_path_lookup()
2626 const char *name, struct dentry *base, int len, in lookup_one_common()
2672 struct dentry *try_lookup_one_len(const char *name, struct dentry *base, int len) in try_lookup_one_len()
2698 struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) in lookup_one_len()
2700 struct dentry *dentry; in lookup_one_len() local
2710 dentry = lookup_dcache(&this, base, 0); in lookup_one_len()
2711 return dentry ? dentry : __lookup_slow(&this, base, 0); in lookup_one_len()
2727 struct dentry *lookup_one(struct user_namespace *mnt_userns, const char *name, in lookup_one()
2728 struct dentry *base, int len) in lookup_one()
2730 struct dentry *dentry; in lookup_one() local
2740 dentry = lookup_dcache(&this, base, 0); in lookup_one()
2741 return dentry ? dentry : __lookup_slow(&this, base, 0); in lookup_one()
2758 struct dentry *lookup_one_unlocked(struct user_namespace *mnt_userns, in lookup_one_unlocked()
2759 const char *name, struct dentry *base, in lookup_one_unlocked()
2764 struct dentry *ret; in lookup_one_unlocked()
2797 struct dentry *lookup_one_positive_unlocked(struct user_namespace *mnt_userns, in lookup_one_positive_unlocked()
2799 struct dentry *base, int len) in lookup_one_positive_unlocked()
2801 struct dentry *ret = lookup_one_unlocked(mnt_userns, name, base, len); in lookup_one_positive_unlocked()
2823 struct dentry *lookup_one_len_unlocked(const char *name, in lookup_one_len_unlocked()
2824 struct dentry *base, int len) in lookup_one_len_unlocked()
2838 struct dentry *lookup_positive_unlocked(const char *name, in lookup_positive_unlocked()
2839 struct dentry *base, int len) in lookup_positive_unlocked()
2851 struct dentry *parent = dget_parent(path->dentry); in path_pts()
2852 struct dentry *child; in path_pts()
2859 dput(path->dentry); in path_pts()
2860 path->dentry = parent; in path_pts()
2865 path->dentry = child; in path_pts()
2917 struct dentry *victim, bool isdir) in may_delete()
2969 struct inode *dir, struct dentry *child) in may_create()
2985 struct dentry *lock_rename(struct dentry *p1, struct dentry *p2) in lock_rename()
2987 struct dentry *p; in lock_rename()
3016 void unlock_rename(struct dentry *p1, struct dentry *p2) in unlock_rename()
3102 struct dentry *dentry, umode_t mode, bool want_excl) in vfs_create() argument
3104 int error = may_create(mnt_userns, dir, dentry); in vfs_create()
3112 error = security_inode_create(dir, dentry, mode); in vfs_create()
3115 error = dir->i_op->create(mnt_userns, dir, dentry, mode, want_excl); in vfs_create()
3117 fsnotify_create(dir, dentry); in vfs_create()
3122 int vfs_mkobj(struct dentry *dentry, umode_t mode, in vfs_mkobj() argument
3123 int (*f)(struct dentry *, umode_t, void *), in vfs_mkobj() argument
3126 struct inode *dir = dentry->d_parent->d_inode; in vfs_mkobj()
3127 int error = may_create(&init_user_ns, dir, dentry); in vfs_mkobj()
3133 error = security_inode_create(dir, dentry, mode); in vfs_mkobj()
3136 error = f(dentry, mode, arg); in vfs_mkobj()
3138 fsnotify_create(dir, dentry); in vfs_mkobj()
3152 struct dentry *dentry = path->dentry; in may_open() local
3153 struct inode *inode = dentry->d_inode; in may_open()
3209 struct inode *inode = path->dentry->d_inode; in handle_truncate()
3216 error = do_truncate(mnt_userns, path->dentry, 0, in handle_truncate()
3232 const struct path *dir, struct dentry *dentry, in may_o_create() argument
3235 int error = security_path_mknod(dir, dentry, mode, 0); in may_o_create()
3239 if (!fsuidgid_has_mapping(dir->dentry->d_sb, mnt_userns)) in may_o_create()
3242 error = inode_permission(mnt_userns, dir->dentry->d_inode, in may_o_create()
3247 return security_inode_create(dir->dentry->d_inode, dentry, mode); in may_o_create()
3263 static struct dentry *atomic_open(struct nameidata *nd, struct dentry *dentry, in atomic_open() argument
3267 struct dentry *const DENTRY_NOT_SET = (void *) -1UL; in atomic_open()
3268 struct inode *dir = nd->path.dentry->d_inode; in atomic_open()
3274 file->f_path.dentry = DENTRY_NOT_SET; in atomic_open()
3276 error = dir->i_op->atomic_open(dir, dentry, file, in atomic_open()
3278 d_lookup_done(dentry); in atomic_open()
3281 if (unlikely(dentry != file->f_path.dentry)) { in atomic_open()
3282 dput(dentry); in atomic_open()
3283 dentry = dget(file->f_path.dentry); in atomic_open()
3285 } else if (WARN_ON(file->f_path.dentry == DENTRY_NOT_SET)) { in atomic_open()
3288 if (file->f_path.dentry) { in atomic_open()
3289 dput(dentry); in atomic_open()
3290 dentry = file->f_path.dentry; in atomic_open()
3292 if (unlikely(d_is_negative(dentry))) in atomic_open()
3297 dput(dentry); in atomic_open()
3298 dentry = ERR_PTR(error); in atomic_open()
3300 return dentry; in atomic_open()
3318 static struct dentry *lookup_open(struct nameidata *nd, struct file *file, in lookup_open()
3323 struct dentry *dir = nd->path.dentry; in lookup_open()
3326 struct dentry *dentry; in lookup_open() local
3335 dentry = d_lookup(dir, &nd->last); in lookup_open()
3337 if (!dentry) { in lookup_open()
3338 dentry = d_alloc_parallel(dir, &nd->last, &wq); in lookup_open()
3339 if (IS_ERR(dentry)) in lookup_open()
3340 return dentry; in lookup_open()
3342 if (d_in_lookup(dentry)) in lookup_open()
3345 error = d_revalidate(dentry, nd->flags); in lookup_open()
3350 d_invalidate(dentry); in lookup_open()
3351 dput(dentry); in lookup_open()
3352 dentry = NULL; in lookup_open()
3354 if (dentry->d_inode) { in lookup_open()
3356 return dentry; in lookup_open()
3377 dentry, mode); in lookup_open()
3384 dentry = atomic_open(nd, dentry, file, open_flag, mode); in lookup_open()
3385 if (unlikely(create_error) && dentry == ERR_PTR(-ENOENT)) in lookup_open()
3386 dentry = ERR_PTR(create_error); in lookup_open()
3387 return dentry; in lookup_open()
3390 if (d_in_lookup(dentry)) { in lookup_open()
3391 struct dentry *res = dir_inode->i_op->lookup(dir_inode, dentry, in lookup_open()
3393 d_lookup_done(dentry); in lookup_open()
3399 dput(dentry); in lookup_open()
3400 dentry = res; in lookup_open()
3405 if (!dentry->d_inode && (open_flag & O_CREAT)) { in lookup_open()
3407 audit_inode_child(dir_inode, dentry, AUDIT_TYPE_CHILD_CREATE); in lookup_open()
3413 error = dir_inode->i_op->create(mnt_userns, dir_inode, dentry, in lookup_open()
3418 if (unlikely(create_error) && !dentry->d_inode) { in lookup_open()
3422 return dentry; in lookup_open()
3425 dput(dentry); in lookup_open()
3432 struct dentry *dir = nd->path.dentry; in open_last_lookups()
3435 struct dentry *dentry; in open_last_lookups() local
3450 dentry = lookup_fast(nd); in open_last_lookups()
3451 if (IS_ERR(dentry)) in open_last_lookups()
3452 return ERR_CAST(dentry); in open_last_lookups()
3453 if (likely(dentry)) in open_last_lookups()
3481 dentry = lookup_open(nd, file, op, got_write); in open_last_lookups()
3482 if (!IS_ERR(dentry) && (file->f_mode & FMODE_CREATED)) in open_last_lookups()
3483 fsnotify_create(dir->d_inode, dentry); in open_last_lookups()
3492 if (IS_ERR(dentry)) in open_last_lookups()
3493 return ERR_CAST(dentry); in open_last_lookups()
3496 dput(nd->path.dentry); in open_last_lookups()
3497 nd->path.dentry = dentry; in open_last_lookups()
3504 res = step_into(nd, WALK_TRAILING, dentry); in open_last_lookups()
3528 audit_inode(nd->name, nd->path.dentry, 0); in do_open()
3533 if (d_is_dir(nd->path.dentry)) in do_open()
3536 d_backing_inode(nd->path.dentry)); in do_open()
3540 if ((nd->flags & LOOKUP_DIRECTORY) && !d_can_lookup(nd->path.dentry)) in do_open()
3549 } else if (d_is_reg(nd->path.dentry) && open_flag & O_TRUNC) { in do_open()
3590 struct dentry *child; in vfs_tmpfile()
3591 struct inode *dir = d_inode(parentpath->dentry); in vfs_tmpfile()
3602 child = d_alloc(parentpath->dentry, &slash_name); in vfs_tmpfile()
3606 file->f_path.dentry = child; in vfs_tmpfile()
3674 audit_inode(nd->name, file->f_path.dentry, 0); in do_tmpfile()
3687 audit_inode(nd->name, path.dentry, 0); in do_o_path()
3758 if (d_is_symlink(root->dentry) && op->intent & LOOKUP_OPEN) in do_file_open_root()
3776 static struct dentry *filename_create(int dfd, struct filename *name, in filename_create()
3779 struct dentry *dentry = ERR_PTR(-EEXIST); in filename_create() local
3807 inode_lock_nested(path->dentry->d_inode, I_MUTEX_PARENT); in filename_create()
3808 dentry = __lookup_hash(&last, path->dentry, reval_flag | create_flags); in filename_create()
3809 if (IS_ERR(dentry)) in filename_create()
3813 if (d_is_positive(dentry)) in filename_create()
3830 return dentry; in filename_create()
3832 dput(dentry); in filename_create()
3833 dentry = ERR_PTR(error); in filename_create()
3835 inode_unlock(path->dentry->d_inode); in filename_create()
3840 return dentry; in filename_create()
3843 struct dentry *kern_path_create(int dfd, const char *pathname, in kern_path_create()
3847 struct dentry *res = filename_create(dfd, filename, path, lookup_flags); in kern_path_create()
3854 void done_path_create(struct path *path, struct dentry *dentry) in done_path_create() argument
3856 dput(dentry); in done_path_create()
3857 inode_unlock(path->dentry->d_inode); in done_path_create()
3863 inline struct dentry *user_path_create(int dfd, const char __user *pathname, in user_path_create()
3867 struct dentry *res = filename_create(dfd, filename, path, lookup_flags); in user_path_create()
3891 struct dentry *dentry, umode_t mode, dev_t dev) in vfs_mknod() argument
3894 int error = may_create(mnt_userns, dir, dentry); in vfs_mknod()
3911 error = security_inode_mknod(dir, dentry, mode, dev); in vfs_mknod()
3915 error = dir->i_op->mknod(mnt_userns, dir, dentry, mode, dev); in vfs_mknod()
3917 fsnotify_create(dir, dentry); in vfs_mknod()
3943 struct dentry *dentry; in do_mknodat() local
3952 dentry = filename_create(dfd, name, &path, lookup_flags); in do_mknodat()
3953 error = PTR_ERR(dentry); in do_mknodat()
3954 if (IS_ERR(dentry)) in do_mknodat()
3957 error = security_path_mknod(&path, dentry, in do_mknodat()
3958 mode_strip_umask(path.dentry->d_inode, mode), dev); in do_mknodat()
3965 error = vfs_create(mnt_userns, path.dentry->d_inode, in do_mknodat()
3966 dentry, mode, true); in do_mknodat()
3968 ima_post_path_mknod(mnt_userns, dentry); in do_mknodat()
3971 error = vfs_mknod(mnt_userns, path.dentry->d_inode, in do_mknodat()
3972 dentry, mode, new_decode_dev(dev)); in do_mknodat()
3975 error = vfs_mknod(mnt_userns, path.dentry->d_inode, in do_mknodat()
3976 dentry, mode, 0); in do_mknodat()
3980 done_path_create(&path, dentry); in do_mknodat()
4017 struct dentry *dentry, umode_t mode) in vfs_mkdir() argument
4019 int error = may_create(mnt_userns, dir, dentry); in vfs_mkdir()
4029 error = security_inode_mkdir(dir, dentry, mode); in vfs_mkdir()
4036 error = dir->i_op->mkdir(mnt_userns, dir, dentry, mode); in vfs_mkdir()
4038 fsnotify_mkdir(dir, dentry); in vfs_mkdir()
4045 struct dentry *dentry; in do_mkdirat() local
4051 dentry = filename_create(dfd, name, &path, lookup_flags); in do_mkdirat()
4052 error = PTR_ERR(dentry); in do_mkdirat()
4053 if (IS_ERR(dentry)) in do_mkdirat()
4056 error = security_path_mkdir(&path, dentry, in do_mkdirat()
4057 mode_strip_umask(path.dentry->d_inode, mode)); in do_mkdirat()
4061 error = vfs_mkdir(mnt_userns, path.dentry->d_inode, dentry, in do_mkdirat()
4064 done_path_create(&path, dentry); in do_mkdirat()
4099 struct dentry *dentry) in vfs_rmdir() argument
4101 int error = may_delete(mnt_userns, dir, dentry, 1); in vfs_rmdir()
4109 dget(dentry); in vfs_rmdir()
4110 inode_lock(dentry->d_inode); in vfs_rmdir()
4113 if (is_local_mountpoint(dentry) || in vfs_rmdir()
4114 (dentry->d_inode->i_flags & S_KERNEL_FILE)) in vfs_rmdir()
4117 error = security_inode_rmdir(dir, dentry); in vfs_rmdir()
4121 error = dir->i_op->rmdir(dir, dentry); in vfs_rmdir()
4125 shrink_dcache_parent(dentry); in vfs_rmdir()
4126 dentry->d_inode->i_flags |= S_DEAD; in vfs_rmdir()
4127 dont_mount(dentry); in vfs_rmdir()
4128 detach_mounts(dentry); in vfs_rmdir()
4131 inode_unlock(dentry->d_inode); in vfs_rmdir()
4132 dput(dentry); in vfs_rmdir()
4134 d_delete_notify(dir, dentry); in vfs_rmdir()
4143 struct dentry *dentry; in do_rmdir() local
4169 inode_lock_nested(path.dentry->d_inode, I_MUTEX_PARENT); in do_rmdir()
4170 dentry = __lookup_hash(&last, path.dentry, lookup_flags); in do_rmdir()
4171 error = PTR_ERR(dentry); in do_rmdir()
4172 if (IS_ERR(dentry)) in do_rmdir()
4174 if (!dentry->d_inode) { in do_rmdir()
4178 error = security_path_rmdir(&path, dentry); in do_rmdir()
4182 error = vfs_rmdir(mnt_userns, path.dentry->d_inode, dentry); in do_rmdir()
4184 dput(dentry); in do_rmdir()
4186 inode_unlock(path.dentry->d_inode); in do_rmdir()
4230 struct dentry *dentry, struct inode **delegated_inode) in vfs_unlink() argument
4232 struct inode *target = dentry->d_inode; in vfs_unlink()
4233 int error = may_delete(mnt_userns, dir, dentry, 0); in vfs_unlink()
4244 else if (is_local_mountpoint(dentry)) in vfs_unlink()
4247 error = security_inode_unlink(dir, dentry); in vfs_unlink()
4252 error = dir->i_op->unlink(dir, dentry); in vfs_unlink()
4254 dont_mount(dentry); in vfs_unlink()
4255 detach_mounts(dentry); in vfs_unlink()
4263 if (!error && dentry->d_flags & DCACHE_NFSFS_RENAMED) { in vfs_unlink()
4264 fsnotify_unlink(dir, dentry); in vfs_unlink()
4267 d_delete_notify(dir, dentry); in vfs_unlink()
4283 struct dentry *dentry; in do_unlinkat() local
4303 inode_lock_nested(path.dentry->d_inode, I_MUTEX_PARENT); in do_unlinkat()
4304 dentry = __lookup_hash(&last, path.dentry, lookup_flags); in do_unlinkat()
4305 error = PTR_ERR(dentry); in do_unlinkat()
4306 if (!IS_ERR(dentry)) { in do_unlinkat()
4312 inode = dentry->d_inode; in do_unlinkat()
4313 if (d_is_negative(dentry)) in do_unlinkat()
4316 error = security_path_unlink(&path, dentry); in do_unlinkat()
4320 error = vfs_unlink(mnt_userns, path.dentry->d_inode, dentry, in do_unlinkat()
4323 dput(dentry); in do_unlinkat()
4325 inode_unlock(path.dentry->d_inode); in do_unlinkat()
4347 if (d_is_negative(dentry)) in do_unlinkat()
4349 else if (d_is_dir(dentry)) in do_unlinkat()
4387 struct dentry *dentry, const char *oldname) in vfs_symlink() argument
4389 int error = may_create(mnt_userns, dir, dentry); in vfs_symlink()
4397 error = security_inode_symlink(dir, dentry, oldname); in vfs_symlink()
4401 error = dir->i_op->symlink(mnt_userns, dir, dentry, oldname); in vfs_symlink()
4403 fsnotify_create(dir, dentry); in vfs_symlink()
4411 struct dentry *dentry; in do_symlinkat() local
4420 dentry = filename_create(newdfd, to, &path, lookup_flags); in do_symlinkat()
4421 error = PTR_ERR(dentry); in do_symlinkat()
4422 if (IS_ERR(dentry)) in do_symlinkat()
4425 error = security_path_symlink(&path, dentry, from->name); in do_symlinkat()
4430 error = vfs_symlink(mnt_userns, path.dentry->d_inode, dentry, in do_symlinkat()
4433 done_path_create(&path, dentry); in do_symlinkat()
4481 int vfs_link(struct dentry *old_dentry, struct user_namespace *mnt_userns, in vfs_link()
4482 struct inode *dir, struct dentry *new_dentry, in vfs_link()
4557 struct dentry *new_dentry; in do_linkat()
4597 error = security_path_link(old_path.dentry, &new_path, new_dentry); in do_linkat()
4600 error = vfs_link(old_path.dentry, mnt_userns, new_path.dentry->d_inode, in do_linkat()
4686 struct dentry *old_dentry = rd->old_dentry; in vfs_rename()
4687 struct dentry *new_dentry = rd->new_dentry; in vfs_rename()
4822 struct dentry *old_dentry, *new_dentry; in do_renameat2()
4823 struct dentry *trap; in do_renameat2()
4871 trap = lock_rename(new_path.dentry, old_path.dentry); in do_renameat2()
4873 old_dentry = __lookup_hash(&old_last, old_path.dentry, lookup_flags); in do_renameat2()
4881 new_dentry = __lookup_hash(&new_last, new_path.dentry, lookup_flags | target_flags); in do_renameat2()
4922 rd.old_dir = old_path.dentry->d_inode; in do_renameat2()
4925 rd.new_dir = new_path.dentry->d_inode; in do_renameat2()
4936 unlock_rename(new_path.dentry, old_path.dentry); in do_renameat2()
5005 int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen) in vfs_readlink() argument
5007 struct inode *inode = d_inode(dentry); in vfs_readlink()
5014 return inode->i_op->readlink(dentry, buffer, buflen); in vfs_readlink()
5016 if (!d_is_symlink(dentry)) in vfs_readlink()
5026 link = inode->i_op->get_link(dentry, inode, &done); in vfs_readlink()
5047 const char *vfs_get_link(struct dentry *dentry, struct delayed_call *done) in vfs_get_link() argument
5050 struct inode *inode = d_inode(dentry); in vfs_get_link()
5052 if (d_is_symlink(dentry)) { in vfs_get_link()
5053 res = ERR_PTR(security_inode_readlink(dentry)); in vfs_get_link()
5055 res = inode->i_op->get_link(dentry, inode, done); in vfs_get_link()
5062 const char *page_get_link(struct dentry *dentry, struct inode *inode, in page_get_link() argument
5069 if (!dentry) { in page_get_link()
5097 int page_readlink(struct dentry *dentry, char __user *buffer, int buflen) in page_readlink() argument
5101 page_get_link(dentry, d_inode(dentry), in page_readlink()