Lines Matching refs:dentry
550 dget(path->dentry); in path_get()
562 dput(path->dentry); in path_put()
604 p->path.dentry = NULL; in __set_nameidata()
653 static bool path_connected(struct vfsmount *mnt, struct dentry *dentry) in path_connected() argument
661 return is_subdir(dentry, mnt->mnt_root); in path_connected()
698 nd->path.dentry = NULL; in terminate_walk()
708 path->dentry = NULL; in __legitimize_path()
711 if (unlikely(!lockref_get_not_dead(&path->dentry->d_lockref))) { in __legitimize_path()
712 path->dentry = NULL; in __legitimize_path()
715 return !read_seqcount_retry(&path->dentry->d_seq, seq); in __legitimize_path()
776 struct dentry *parent = nd->path.dentry; in try_to_unlazy()
792 nd->path.dentry = NULL; in try_to_unlazy()
810 static bool try_to_unlazy_next(struct nameidata *nd, struct dentry *dentry) in try_to_unlazy_next() argument
823 if (unlikely(!lockref_get_not_dead(&nd->path.dentry->d_lockref))) in try_to_unlazy_next()
833 if (unlikely(!lockref_get_not_dead(&dentry->d_lockref))) in try_to_unlazy_next()
835 if (read_seqcount_retry(&dentry->d_seq, nd->next_seq)) in try_to_unlazy_next()
849 nd->path.dentry = NULL; in try_to_unlazy_next()
855 dput(dentry); in try_to_unlazy_next()
859 static inline int d_revalidate(struct dentry *dentry, unsigned int flags) in d_revalidate() argument
861 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) in d_revalidate()
862 return dentry->d_op->d_revalidate(dentry, flags); in d_revalidate()
879 struct dentry *dentry = nd->path.dentry; in complete_walk() local
919 if (likely(!(dentry->d_flags & DCACHE_OP_WEAK_REVALIDATE))) in complete_walk()
922 status = dentry->d_op->d_weak_revalidate(dentry, nd->flags); in complete_walk()
950 nd->root_seq = __read_seqcount_begin(&nd->root.dentry->d_seq); in set_root()
974 struct dentry *d; in nd_jump_root()
976 d = nd->path.dentry; in nd_jump_root()
985 nd->inode = nd->path.dentry->d_inode; in nd_jump_root()
1014 nd->inode = nd->path.dentry->d_inode; in nd_jump_link()
1127 audit_inode(nd->name, nd->stack[0].link.dentry, 0); in may_follow_link()
1190 struct inode *inode = link->dentry->d_inode; in may_linkat()
1278 struct dentry *mountpoint; in follow_up()
1289 dput(path->dentry); in follow_up()
1290 path->dentry = mountpoint; in follow_up()
1301 struct dentry *mountpoint = m->mnt_mountpoint; in choose_mountpoint_rcu()
1304 if (unlikely(root->dentry == mountpoint && in choose_mountpoint_rcu()
1309 path->dentry = mountpoint; in choose_mountpoint_rcu()
1349 struct dentry *dentry = path->dentry; in follow_automount() local
1364 dentry->d_inode) in follow_automount()
1370 return finish_automount(dentry->d_op->d_automount(path), path); in follow_automount()
1390 ret = path->dentry->d_op->d_manage(path, false); in __traverse_mounts()
1391 flags = smp_load_acquire(&path->dentry->d_flags); in __traverse_mounts()
1399 dput(path->dentry); in __traverse_mounts()
1403 path->dentry = dget(mounted->mnt_root); in __traverse_mounts()
1405 flags = path->dentry->d_flags; in __traverse_mounts()
1416 flags = smp_load_acquire(&path->dentry->d_flags); in __traverse_mounts()
1435 unsigned flags = smp_load_acquire(&path->dentry->d_flags); in traverse_mounts()
1453 dput(path->dentry); in follow_down_one()
1456 path->dentry = dget(mounted->mnt_root); in follow_down_one()
1486 struct dentry *dentry = path->dentry; in __follow_mount_rcu() local
1487 unsigned int flags = dentry->d_flags; in __follow_mount_rcu()
1501 int res = dentry->d_op->d_manage(path, true); in __follow_mount_rcu()
1504 flags = dentry->d_flags; in __follow_mount_rcu()
1508 struct mount *mounted = __lookup_mnt(path->mnt, dentry); in __follow_mount_rcu()
1511 dentry = path->dentry = mounted->mnt.mnt_root; in __follow_mount_rcu()
1513 nd->next_seq = read_seqcount_begin(&dentry->d_seq); in __follow_mount_rcu()
1514 flags = dentry->d_flags; in __follow_mount_rcu()
1528 static inline int handle_mounts(struct nameidata *nd, struct dentry *dentry, in handle_mounts() argument
1535 path->dentry = dentry; in handle_mounts()
1542 path->dentry = dentry; in handle_mounts()
1544 if (!try_to_unlazy_next(nd, dentry)) in handle_mounts()
1555 dput(path->dentry); in handle_mounts()
1566 static struct dentry *lookup_dcache(const struct qstr *name, in lookup_dcache()
1567 struct dentry *dir, in lookup_dcache()
1570 struct dentry *dentry = d_lookup(dir, name); in lookup_dcache() local
1571 if (dentry) { in lookup_dcache()
1572 int error = d_revalidate(dentry, flags); in lookup_dcache()
1575 d_invalidate(dentry); in lookup_dcache()
1576 dput(dentry); in lookup_dcache()
1580 return dentry; in lookup_dcache()
1590 struct dentry *lookup_one_qstr_excl(const struct qstr *name, in lookup_one_qstr_excl()
1591 struct dentry *base, in lookup_one_qstr_excl()
1594 struct dentry *dentry = lookup_dcache(name, base, flags); in lookup_one_qstr_excl() local
1595 struct dentry *old; in lookup_one_qstr_excl()
1598 if (dentry) in lookup_one_qstr_excl()
1599 return dentry; in lookup_one_qstr_excl()
1605 dentry = d_alloc(base, name); in lookup_one_qstr_excl()
1606 if (unlikely(!dentry)) in lookup_one_qstr_excl()
1609 old = dir->i_op->lookup(dir, dentry, flags); in lookup_one_qstr_excl()
1611 dput(dentry); in lookup_one_qstr_excl()
1612 dentry = old; in lookup_one_qstr_excl()
1614 return dentry; in lookup_one_qstr_excl()
1618 static struct dentry *lookup_fast(struct nameidata *nd) in lookup_fast()
1620 struct dentry *dentry, *parent = nd->path.dentry; in lookup_fast() local
1629 dentry = __d_lookup_rcu(parent, &nd->last, &nd->next_seq); in lookup_fast()
1630 if (unlikely(!dentry)) { in lookup_fast()
1643 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1645 return dentry; in lookup_fast()
1646 if (!try_to_unlazy_next(nd, dentry)) in lookup_fast()
1650 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1652 dentry = __d_lookup(parent, &nd->last); in lookup_fast()
1653 if (unlikely(!dentry)) in lookup_fast()
1655 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1659 d_invalidate(dentry); in lookup_fast()
1660 dput(dentry); in lookup_fast()
1663 return dentry; in lookup_fast()
1667 static struct dentry *__lookup_slow(const struct qstr *name, in __lookup_slow()
1668 struct dentry *dir, in __lookup_slow()
1671 struct dentry *dentry, *old; in __lookup_slow() local
1679 dentry = d_alloc_parallel(dir, name, &wq); in __lookup_slow()
1680 if (IS_ERR(dentry)) in __lookup_slow()
1681 return dentry; in __lookup_slow()
1682 if (unlikely(!d_in_lookup(dentry))) { in __lookup_slow()
1683 int error = d_revalidate(dentry, flags); in __lookup_slow()
1686 d_invalidate(dentry); in __lookup_slow()
1687 dput(dentry); in __lookup_slow()
1690 dput(dentry); in __lookup_slow()
1691 dentry = ERR_PTR(error); in __lookup_slow()
1694 old = inode->i_op->lookup(inode, dentry, flags); in __lookup_slow()
1695 d_lookup_done(dentry); in __lookup_slow()
1697 dput(dentry); in __lookup_slow()
1698 dentry = old; in __lookup_slow()
1701 return dentry; in __lookup_slow()
1704 static struct dentry *lookup_slow(const struct qstr *name, in lookup_slow()
1705 struct dentry *dir, in lookup_slow()
1709 struct dentry *res; in lookup_slow()
1791 error = security_inode_follow_link(link->dentry, inode, in pick_link()
1798 const char * (*get)(struct dentry *, struct inode *, in pick_link()
1804 res = get(link->dentry, inode, &last->done); in pick_link()
1806 res = get(link->dentry, inode, &last->done); in pick_link()
1836 struct dentry *dentry) in step_into() argument
1840 int err = handle_mounts(nd, dentry, &path); in step_into()
1844 inode = path.dentry->d_inode; in step_into()
1845 if (likely(!d_is_symlink(path.dentry)) || in step_into()
1850 if (read_seqcount_retry(&path.dentry->d_seq, nd->next_seq)) in step_into()
1855 dput(nd->path.dentry); in step_into()
1866 if (read_seqcount_retry(&path.dentry->d_seq, nd->next_seq)) in step_into()
1875 static struct dentry *follow_dotdot_rcu(struct nameidata *nd) in follow_dotdot_rcu()
1877 struct dentry *parent, *old; in follow_dotdot_rcu()
1881 if (unlikely(nd->path.dentry == nd->path.mnt->mnt_root)) { in follow_dotdot_rcu()
1890 nd->inode = path.dentry->d_inode; in follow_dotdot_rcu()
1897 old = nd->path.dentry; in follow_dotdot_rcu()
1912 return nd->path.dentry; in follow_dotdot_rcu()
1915 static struct dentry *follow_dotdot(struct nameidata *nd) in follow_dotdot()
1917 struct dentry *parent; in follow_dotdot()
1921 if (unlikely(nd->path.dentry == nd->path.mnt->mnt_root)) { in follow_dotdot()
1929 nd->inode = path.dentry->d_inode; in follow_dotdot()
1934 parent = dget_parent(nd->path.dentry); in follow_dotdot()
1944 return dget(nd->path.dentry); in follow_dotdot()
1951 struct dentry *parent; in handle_dots()
1987 struct dentry *dentry; in walk_component() local
1998 dentry = lookup_fast(nd); in walk_component()
1999 if (IS_ERR(dentry)) in walk_component()
2000 return ERR_CAST(dentry); in walk_component()
2001 if (unlikely(!dentry)) { in walk_component()
2002 dentry = lookup_slow(&nd->last, nd->path.dentry, nd->flags); in walk_component()
2003 if (IS_ERR(dentry)) in walk_component()
2004 return ERR_CAST(dentry); in walk_component()
2008 return step_into(nd, flags, dentry); in walk_component()
2275 hash_len = hash_name(nd->path.dentry, name); in link_path_walk()
2289 struct dentry *parent = nd->path.dentry; in link_path_walk()
2339 if (unlikely(!d_can_lookup(nd->path.dentry))) { in link_path_walk()
2374 struct dentry *root = nd->root.dentry; in path_init()
2381 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
2408 nd->inode = nd->path.dentry->d_inode; in path_init()
2409 nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
2413 nd->inode = nd->path.dentry->d_inode; in path_init()
2418 struct dentry *dentry; in path_init() local
2423 dentry = f.file->f_path.dentry; in path_init()
2425 if (*s && unlikely(!d_can_lookup(dentry))) { in path_init()
2432 nd->inode = nd->path.dentry->d_inode; in path_init()
2433 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
2436 nd->inode = nd->path.dentry->d_inode; in path_init()
2465 dget(nd->path.dentry); in handle_lookup_down()
2467 return PTR_ERR(step_into(nd, WALK_NOFOLLOW, nd->path.dentry)); in handle_lookup_down()
2493 if (!d_can_lookup(nd->path.dentry)) in path_lookupat()
2498 nd->path.dentry = NULL; in path_lookupat()
2519 audit_inode(name, path->dentry, in filename_lookup()
2536 nd->path.dentry = NULL; in path_parentat()
2562 audit_inode(name, parent->dentry, AUDIT_INODE_PARENT); in __filename_parentat()
2576 static struct dentry *__kern_path_locked(struct filename *name, struct path *path) in __kern_path_locked()
2578 struct dentry *d; in __kern_path_locked()
2589 inode_lock_nested(path->dentry->d_inode, I_MUTEX_PARENT); in __kern_path_locked()
2590 d = lookup_one_qstr_excl(&last, path->dentry, 0); in __kern_path_locked()
2592 inode_unlock(path->dentry->d_inode); in __kern_path_locked()
2598 struct dentry *kern_path_locked(const char *name, struct path *path) in kern_path_locked()
2601 struct dentry *res = __kern_path_locked(filename, path); in kern_path_locked()
2644 int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, in vfs_path_lookup() argument
2649 struct path root = {.mnt = mnt, .dentry = dentry}; in vfs_path_lookup()
2661 const char *name, struct dentry *base, int len, in lookup_one_common()
2707 struct dentry *try_lookup_one_len(const char *name, struct dentry *base, int len) in try_lookup_one_len()
2733 struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) in lookup_one_len()
2735 struct dentry *dentry; in lookup_one_len() local
2745 dentry = lookup_dcache(&this, base, 0); in lookup_one_len()
2746 return dentry ? dentry : __lookup_slow(&this, base, 0); in lookup_one_len()
2762 struct dentry *lookup_one(struct mnt_idmap *idmap, const char *name, in lookup_one()
2763 struct dentry *base, int len) in lookup_one()
2765 struct dentry *dentry; in lookup_one() local
2775 dentry = lookup_dcache(&this, base, 0); in lookup_one()
2776 return dentry ? dentry : __lookup_slow(&this, base, 0); in lookup_one()
2793 struct dentry *lookup_one_unlocked(struct mnt_idmap *idmap, in lookup_one_unlocked()
2794 const char *name, struct dentry *base, in lookup_one_unlocked()
2799 struct dentry *ret; in lookup_one_unlocked()
2832 struct dentry *lookup_one_positive_unlocked(struct mnt_idmap *idmap, in lookup_one_positive_unlocked()
2834 struct dentry *base, int len) in lookup_one_positive_unlocked()
2836 struct dentry *ret = lookup_one_unlocked(idmap, name, base, len); in lookup_one_positive_unlocked()
2858 struct dentry *lookup_one_len_unlocked(const char *name, in lookup_one_len_unlocked()
2859 struct dentry *base, int len) in lookup_one_len_unlocked()
2873 struct dentry *lookup_positive_unlocked(const char *name, in lookup_positive_unlocked()
2874 struct dentry *base, int len) in lookup_positive_unlocked()
2886 struct dentry *parent = dget_parent(path->dentry); in path_pts()
2887 struct dentry *child; in path_pts()
2894 dput(path->dentry); in path_pts()
2895 path->dentry = parent; in path_pts()
2900 path->dentry = child; in path_pts()
2952 struct dentry *victim, bool isdir) in may_delete()
3004 struct inode *dir, struct dentry *child) in may_create()
3017 static struct dentry *lock_two_directories(struct dentry *p1, struct dentry *p2) in lock_two_directories()
3019 struct dentry *p; in lock_two_directories()
3043 struct dentry *lock_rename(struct dentry *p1, struct dentry *p2) in lock_rename()
3058 struct dentry *lock_rename_child(struct dentry *c1, struct dentry *p2) in lock_rename_child()
3097 void unlock_rename(struct dentry *p1, struct dentry *p2) in unlock_rename()
3183 struct dentry *dentry, umode_t mode, bool want_excl) in vfs_create() argument
3187 error = may_create(idmap, dir, dentry); in vfs_create()
3195 error = security_inode_create(dir, dentry, mode); in vfs_create()
3198 error = dir->i_op->create(idmap, dir, dentry, mode, want_excl); in vfs_create()
3200 fsnotify_create(dir, dentry); in vfs_create()
3205 int vfs_mkobj(struct dentry *dentry, umode_t mode, in vfs_mkobj() argument
3206 int (*f)(struct dentry *, umode_t, void *), in vfs_mkobj() argument
3209 struct inode *dir = dentry->d_parent->d_inode; in vfs_mkobj()
3210 int error = may_create(&nop_mnt_idmap, dir, dentry); in vfs_mkobj()
3216 error = security_inode_create(dir, dentry, mode); in vfs_mkobj()
3219 error = f(dentry, mode, arg); in vfs_mkobj()
3221 fsnotify_create(dir, dentry); in vfs_mkobj()
3235 struct dentry *dentry = path->dentry; in may_open() local
3236 struct inode *inode = dentry->d_inode; in may_open()
3292 struct inode *inode = path->dentry->d_inode; in handle_truncate()
3299 error = do_truncate(idmap, path->dentry, 0, in handle_truncate()
3315 const struct path *dir, struct dentry *dentry, in may_o_create() argument
3318 int error = security_path_mknod(dir, dentry, mode, 0); in may_o_create()
3322 if (!fsuidgid_has_mapping(dir->dentry->d_sb, idmap)) in may_o_create()
3325 error = inode_permission(idmap, dir->dentry->d_inode, in may_o_create()
3330 return security_inode_create(dir->dentry->d_inode, dentry, mode); in may_o_create()
3346 static struct dentry *atomic_open(struct nameidata *nd, struct dentry *dentry, in atomic_open() argument
3350 struct dentry *const DENTRY_NOT_SET = (void *) -1UL; in atomic_open()
3351 struct inode *dir = nd->path.dentry->d_inode; in atomic_open()
3357 file->f_path.dentry = DENTRY_NOT_SET; in atomic_open()
3359 error = dir->i_op->atomic_open(dir, dentry, file, in atomic_open()
3361 d_lookup_done(dentry); in atomic_open()
3364 if (unlikely(dentry != file->f_path.dentry)) { in atomic_open()
3365 dput(dentry); in atomic_open()
3366 dentry = dget(file->f_path.dentry); in atomic_open()
3368 } else if (WARN_ON(file->f_path.dentry == DENTRY_NOT_SET)) { in atomic_open()
3371 if (file->f_path.dentry) { in atomic_open()
3372 dput(dentry); in atomic_open()
3373 dentry = file->f_path.dentry; in atomic_open()
3375 if (unlikely(d_is_negative(dentry))) in atomic_open()
3380 dput(dentry); in atomic_open()
3381 dentry = ERR_PTR(error); in atomic_open()
3383 return dentry; in atomic_open()
3401 static struct dentry *lookup_open(struct nameidata *nd, struct file *file, in lookup_open()
3406 struct dentry *dir = nd->path.dentry; in lookup_open()
3409 struct dentry *dentry; in lookup_open() local
3418 dentry = d_lookup(dir, &nd->last); in lookup_open()
3420 if (!dentry) { in lookup_open()
3421 dentry = d_alloc_parallel(dir, &nd->last, &wq); in lookup_open()
3422 if (IS_ERR(dentry)) in lookup_open()
3423 return dentry; in lookup_open()
3425 if (d_in_lookup(dentry)) in lookup_open()
3428 error = d_revalidate(dentry, nd->flags); in lookup_open()
3433 d_invalidate(dentry); in lookup_open()
3434 dput(dentry); in lookup_open()
3435 dentry = NULL; in lookup_open()
3437 if (dentry->d_inode) { in lookup_open()
3439 return dentry; in lookup_open()
3460 dentry, mode); in lookup_open()
3467 dentry = atomic_open(nd, dentry, file, open_flag, mode); in lookup_open()
3468 if (unlikely(create_error) && dentry == ERR_PTR(-ENOENT)) in lookup_open()
3469 dentry = ERR_PTR(create_error); in lookup_open()
3470 return dentry; in lookup_open()
3473 if (d_in_lookup(dentry)) { in lookup_open()
3474 struct dentry *res = dir_inode->i_op->lookup(dir_inode, dentry, in lookup_open()
3476 d_lookup_done(dentry); in lookup_open()
3482 dput(dentry); in lookup_open()
3483 dentry = res; in lookup_open()
3488 if (!dentry->d_inode && (open_flag & O_CREAT)) { in lookup_open()
3490 audit_inode_child(dir_inode, dentry, AUDIT_TYPE_CHILD_CREATE); in lookup_open()
3496 error = dir_inode->i_op->create(idmap, dir_inode, dentry, in lookup_open()
3501 if (unlikely(create_error) && !dentry->d_inode) { in lookup_open()
3505 return dentry; in lookup_open()
3508 dput(dentry); in lookup_open()
3515 struct dentry *dir = nd->path.dentry; in open_last_lookups()
3518 struct dentry *dentry; in open_last_lookups() local
3533 dentry = lookup_fast(nd); in open_last_lookups()
3534 if (IS_ERR(dentry)) in open_last_lookups()
3535 return ERR_CAST(dentry); in open_last_lookups()
3536 if (likely(dentry)) in open_last_lookups()
3564 dentry = lookup_open(nd, file, op, got_write); in open_last_lookups()
3565 if (!IS_ERR(dentry) && (file->f_mode & FMODE_CREATED)) in open_last_lookups()
3566 fsnotify_create(dir->d_inode, dentry); in open_last_lookups()
3575 if (IS_ERR(dentry)) in open_last_lookups()
3576 return ERR_CAST(dentry); in open_last_lookups()
3579 dput(nd->path.dentry); in open_last_lookups()
3580 nd->path.dentry = dentry; in open_last_lookups()
3587 res = step_into(nd, WALK_TRAILING, dentry); in open_last_lookups()
3611 audit_inode(nd->name, nd->path.dentry, 0); in do_open()
3616 if (d_is_dir(nd->path.dentry)) in do_open()
3619 d_backing_inode(nd->path.dentry)); in do_open()
3623 if ((nd->flags & LOOKUP_DIRECTORY) && !d_can_lookup(nd->path.dentry)) in do_open()
3632 } else if (d_is_reg(nd->path.dentry) && open_flag & O_TRUNC) { in do_open()
3673 struct dentry *child; in vfs_tmpfile()
3674 struct inode *dir = d_inode(parentpath->dentry); in vfs_tmpfile()
3685 child = d_alloc(parentpath->dentry, &slash_name); in vfs_tmpfile()
3689 file->f_path.dentry = child; in vfs_tmpfile()
3757 audit_inode(nd->name, file->f_path.dentry, 0); in do_tmpfile()
3770 audit_inode(nd->name, path.dentry, 0); in do_o_path()
3841 if (d_is_symlink(root->dentry) && op->intent & LOOKUP_OPEN) in do_file_open_root()
3859 static struct dentry *filename_create(int dfd, struct filename *name, in filename_create()
3862 struct dentry *dentry = ERR_PTR(-EEXIST); in filename_create() local
3890 inode_lock_nested(path->dentry->d_inode, I_MUTEX_PARENT); in filename_create()
3891 dentry = lookup_one_qstr_excl(&last, path->dentry, in filename_create()
3893 if (IS_ERR(dentry)) in filename_create()
3897 if (d_is_positive(dentry)) in filename_create()
3914 return dentry; in filename_create()
3916 dput(dentry); in filename_create()
3917 dentry = ERR_PTR(error); in filename_create()
3919 inode_unlock(path->dentry->d_inode); in filename_create()
3924 return dentry; in filename_create()
3927 struct dentry *kern_path_create(int dfd, const char *pathname, in kern_path_create()
3931 struct dentry *res = filename_create(dfd, filename, path, lookup_flags); in kern_path_create()
3938 void done_path_create(struct path *path, struct dentry *dentry) in done_path_create() argument
3940 dput(dentry); in done_path_create()
3941 inode_unlock(path->dentry->d_inode); in done_path_create()
3947 inline struct dentry *user_path_create(int dfd, const char __user *pathname, in user_path_create()
3951 struct dentry *res = filename_create(dfd, filename, path, lookup_flags); in user_path_create()
3975 struct dentry *dentry, umode_t mode, dev_t dev) in vfs_mknod() argument
3978 int error = may_create(idmap, dir, dentry); in vfs_mknod()
3995 error = security_inode_mknod(dir, dentry, mode, dev); in vfs_mknod()
3999 error = dir->i_op->mknod(idmap, dir, dentry, mode, dev); in vfs_mknod()
4001 fsnotify_create(dir, dentry); in vfs_mknod()
4027 struct dentry *dentry; in do_mknodat() local
4036 dentry = filename_create(dfd, name, &path, lookup_flags); in do_mknodat()
4037 error = PTR_ERR(dentry); in do_mknodat()
4038 if (IS_ERR(dentry)) in do_mknodat()
4041 error = security_path_mknod(&path, dentry, in do_mknodat()
4042 mode_strip_umask(path.dentry->d_inode, mode), dev); in do_mknodat()
4049 error = vfs_create(idmap, path.dentry->d_inode, in do_mknodat()
4050 dentry, mode, true); in do_mknodat()
4052 ima_post_path_mknod(idmap, dentry); in do_mknodat()
4055 error = vfs_mknod(idmap, path.dentry->d_inode, in do_mknodat()
4056 dentry, mode, new_decode_dev(dev)); in do_mknodat()
4059 error = vfs_mknod(idmap, path.dentry->d_inode, in do_mknodat()
4060 dentry, mode, 0); in do_mknodat()
4064 done_path_create(&path, dentry); in do_mknodat()
4101 struct dentry *dentry, umode_t mode) in vfs_mkdir() argument
4106 error = may_create(idmap, dir, dentry); in vfs_mkdir()
4114 error = security_inode_mkdir(dir, dentry, mode); in vfs_mkdir()
4121 error = dir->i_op->mkdir(idmap, dir, dentry, mode); in vfs_mkdir()
4123 fsnotify_mkdir(dir, dentry); in vfs_mkdir()
4130 struct dentry *dentry; in do_mkdirat() local
4136 dentry = filename_create(dfd, name, &path, lookup_flags); in do_mkdirat()
4137 error = PTR_ERR(dentry); in do_mkdirat()
4138 if (IS_ERR(dentry)) in do_mkdirat()
4141 error = security_path_mkdir(&path, dentry, in do_mkdirat()
4142 mode_strip_umask(path.dentry->d_inode, mode)); in do_mkdirat()
4144 error = vfs_mkdir(mnt_idmap(path.mnt), path.dentry->d_inode, in do_mkdirat()
4145 dentry, mode); in do_mkdirat()
4147 done_path_create(&path, dentry); in do_mkdirat()
4182 struct dentry *dentry) in vfs_rmdir() argument
4184 int error = may_delete(idmap, dir, dentry, 1); in vfs_rmdir()
4192 dget(dentry); in vfs_rmdir()
4193 inode_lock(dentry->d_inode); in vfs_rmdir()
4196 if (is_local_mountpoint(dentry) || in vfs_rmdir()
4197 (dentry->d_inode->i_flags & S_KERNEL_FILE)) in vfs_rmdir()
4200 error = security_inode_rmdir(dir, dentry); in vfs_rmdir()
4204 error = dir->i_op->rmdir(dir, dentry); in vfs_rmdir()
4208 shrink_dcache_parent(dentry); in vfs_rmdir()
4209 dentry->d_inode->i_flags |= S_DEAD; in vfs_rmdir()
4210 dont_mount(dentry); in vfs_rmdir()
4211 detach_mounts(dentry); in vfs_rmdir()
4214 inode_unlock(dentry->d_inode); in vfs_rmdir()
4215 dput(dentry); in vfs_rmdir()
4217 d_delete_notify(dir, dentry); in vfs_rmdir()
4225 struct dentry *dentry; in do_rmdir() local
4251 inode_lock_nested(path.dentry->d_inode, I_MUTEX_PARENT); in do_rmdir()
4252 dentry = lookup_one_qstr_excl(&last, path.dentry, lookup_flags); in do_rmdir()
4253 error = PTR_ERR(dentry); in do_rmdir()
4254 if (IS_ERR(dentry)) in do_rmdir()
4256 if (!dentry->d_inode) { in do_rmdir()
4260 error = security_path_rmdir(&path, dentry); in do_rmdir()
4263 error = vfs_rmdir(mnt_idmap(path.mnt), path.dentry->d_inode, dentry); in do_rmdir()
4265 dput(dentry); in do_rmdir()
4267 inode_unlock(path.dentry->d_inode); in do_rmdir()
4311 struct dentry *dentry, struct inode **delegated_inode) in vfs_unlink() argument
4313 struct inode *target = dentry->d_inode; in vfs_unlink()
4314 int error = may_delete(idmap, dir, dentry, 0); in vfs_unlink()
4325 else if (is_local_mountpoint(dentry)) in vfs_unlink()
4328 error = security_inode_unlink(dir, dentry); in vfs_unlink()
4333 error = dir->i_op->unlink(dir, dentry); in vfs_unlink()
4335 dont_mount(dentry); in vfs_unlink()
4336 detach_mounts(dentry); in vfs_unlink()
4344 if (!error && dentry->d_flags & DCACHE_NFSFS_RENAMED) { in vfs_unlink()
4345 fsnotify_unlink(dir, dentry); in vfs_unlink()
4348 d_delete_notify(dir, dentry); in vfs_unlink()
4364 struct dentry *dentry; in do_unlinkat() local
4384 inode_lock_nested(path.dentry->d_inode, I_MUTEX_PARENT); in do_unlinkat()
4385 dentry = lookup_one_qstr_excl(&last, path.dentry, lookup_flags); in do_unlinkat()
4386 error = PTR_ERR(dentry); in do_unlinkat()
4387 if (!IS_ERR(dentry)) { in do_unlinkat()
4392 inode = dentry->d_inode; in do_unlinkat()
4393 if (d_is_negative(dentry)) in do_unlinkat()
4396 error = security_path_unlink(&path, dentry); in do_unlinkat()
4399 error = vfs_unlink(mnt_idmap(path.mnt), path.dentry->d_inode, in do_unlinkat()
4400 dentry, &delegated_inode); in do_unlinkat()
4402 dput(dentry); in do_unlinkat()
4404 inode_unlock(path.dentry->d_inode); in do_unlinkat()
4426 if (d_is_negative(dentry)) in do_unlinkat()
4428 else if (d_is_dir(dentry)) in do_unlinkat()
4466 struct dentry *dentry, const char *oldname) in vfs_symlink() argument
4470 error = may_create(idmap, dir, dentry); in vfs_symlink()
4477 error = security_inode_symlink(dir, dentry, oldname); in vfs_symlink()
4481 error = dir->i_op->symlink(idmap, dir, dentry, oldname); in vfs_symlink()
4483 fsnotify_create(dir, dentry); in vfs_symlink()
4491 struct dentry *dentry; in do_symlinkat() local
4500 dentry = filename_create(newdfd, to, &path, lookup_flags); in do_symlinkat()
4501 error = PTR_ERR(dentry); in do_symlinkat()
4502 if (IS_ERR(dentry)) in do_symlinkat()
4505 error = security_path_symlink(&path, dentry, from->name); in do_symlinkat()
4507 error = vfs_symlink(mnt_idmap(path.mnt), path.dentry->d_inode, in do_symlinkat()
4508 dentry, from->name); in do_symlinkat()
4509 done_path_create(&path, dentry); in do_symlinkat()
4557 int vfs_link(struct dentry *old_dentry, struct mnt_idmap *idmap, in vfs_link()
4558 struct inode *dir, struct dentry *new_dentry, in vfs_link()
4633 struct dentry *new_dentry; in do_linkat()
4673 error = security_path_link(old_path.dentry, &new_path, new_dentry); in do_linkat()
4676 error = vfs_link(old_path.dentry, idmap, new_path.dentry->d_inode, in do_linkat()
4762 struct dentry *old_dentry = rd->old_dentry; in vfs_rename()
4763 struct dentry *new_dentry = rd->new_dentry; in vfs_rename()
4903 struct dentry *old_dentry, *new_dentry; in do_renameat2()
4904 struct dentry *trap; in do_renameat2()
4952 trap = lock_rename(new_path.dentry, old_path.dentry); in do_renameat2()
4954 old_dentry = lookup_one_qstr_excl(&old_last, old_path.dentry, in do_renameat2()
4963 new_dentry = lookup_one_qstr_excl(&new_last, new_path.dentry, in do_renameat2()
5005 rd.old_dir = old_path.dentry->d_inode; in do_renameat2()
5008 rd.new_dir = new_path.dentry->d_inode; in do_renameat2()
5019 unlock_rename(new_path.dentry, old_path.dentry); in do_renameat2()
5088 int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen) in vfs_readlink() argument
5090 struct inode *inode = d_inode(dentry); in vfs_readlink()
5097 return inode->i_op->readlink(dentry, buffer, buflen); in vfs_readlink()
5099 if (!d_is_symlink(dentry)) in vfs_readlink()
5109 link = inode->i_op->get_link(dentry, inode, &done); in vfs_readlink()
5130 const char *vfs_get_link(struct dentry *dentry, struct delayed_call *done) in vfs_get_link() argument
5133 struct inode *inode = d_inode(dentry); in vfs_get_link()
5135 if (d_is_symlink(dentry)) { in vfs_get_link()
5136 res = ERR_PTR(security_inode_readlink(dentry)); in vfs_get_link()
5138 res = inode->i_op->get_link(dentry, inode, done); in vfs_get_link()
5145 const char *page_get_link(struct dentry *dentry, struct inode *inode, in page_get_link() argument
5152 if (!dentry) { in page_get_link()
5180 int page_readlink(struct dentry *dentry, char __user *buffer, int buflen) in page_readlink() argument
5184 page_get_link(dentry, d_inode(dentry), in page_readlink()