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()
3037 struct dentry *lock_rename(struct dentry *p1, struct dentry *p2) in lock_rename()
3052 struct dentry *lock_rename_child(struct dentry *c1, struct dentry *p2) in lock_rename_child()
3091 void unlock_rename(struct dentry *p1, struct dentry *p2) in unlock_rename()
3177 struct dentry *dentry, umode_t mode, bool want_excl) in vfs_create() argument
3181 error = may_create(idmap, dir, dentry); in vfs_create()
3189 error = security_inode_create(dir, dentry, mode); in vfs_create()
3192 error = dir->i_op->create(idmap, dir, dentry, mode, want_excl); in vfs_create()
3194 fsnotify_create(dir, dentry); in vfs_create()
3199 int vfs_mkobj(struct dentry *dentry, umode_t mode, in vfs_mkobj() argument
3200 int (*f)(struct dentry *, umode_t, void *), in vfs_mkobj() argument
3203 struct inode *dir = dentry->d_parent->d_inode; in vfs_mkobj()
3204 int error = may_create(&nop_mnt_idmap, dir, dentry); in vfs_mkobj()
3210 error = security_inode_create(dir, dentry, mode); in vfs_mkobj()
3213 error = f(dentry, mode, arg); in vfs_mkobj()
3215 fsnotify_create(dir, dentry); in vfs_mkobj()
3229 struct dentry *dentry = path->dentry; in may_open() local
3230 struct inode *inode = dentry->d_inode; in may_open()
3286 struct inode *inode = path->dentry->d_inode; in handle_truncate()
3293 error = do_truncate(idmap, path->dentry, 0, in handle_truncate()
3309 const struct path *dir, struct dentry *dentry, in may_o_create() argument
3312 int error = security_path_mknod(dir, dentry, mode, 0); in may_o_create()
3316 if (!fsuidgid_has_mapping(dir->dentry->d_sb, idmap)) in may_o_create()
3319 error = inode_permission(idmap, dir->dentry->d_inode, in may_o_create()
3324 return security_inode_create(dir->dentry->d_inode, dentry, mode); in may_o_create()
3340 static struct dentry *atomic_open(struct nameidata *nd, struct dentry *dentry, in atomic_open() argument
3344 struct dentry *const DENTRY_NOT_SET = (void *) -1UL; in atomic_open()
3345 struct inode *dir = nd->path.dentry->d_inode; in atomic_open()
3351 file->f_path.dentry = DENTRY_NOT_SET; in atomic_open()
3353 error = dir->i_op->atomic_open(dir, dentry, file, in atomic_open()
3355 d_lookup_done(dentry); in atomic_open()
3358 if (unlikely(dentry != file->f_path.dentry)) { in atomic_open()
3359 dput(dentry); in atomic_open()
3360 dentry = dget(file->f_path.dentry); in atomic_open()
3362 } else if (WARN_ON(file->f_path.dentry == DENTRY_NOT_SET)) { in atomic_open()
3365 if (file->f_path.dentry) { in atomic_open()
3366 dput(dentry); in atomic_open()
3367 dentry = file->f_path.dentry; in atomic_open()
3369 if (unlikely(d_is_negative(dentry))) in atomic_open()
3374 dput(dentry); in atomic_open()
3375 dentry = ERR_PTR(error); in atomic_open()
3377 return dentry; in atomic_open()
3395 static struct dentry *lookup_open(struct nameidata *nd, struct file *file, in lookup_open()
3400 struct dentry *dir = nd->path.dentry; in lookup_open()
3403 struct dentry *dentry; in lookup_open() local
3412 dentry = d_lookup(dir, &nd->last); in lookup_open()
3414 if (!dentry) { in lookup_open()
3415 dentry = d_alloc_parallel(dir, &nd->last, &wq); in lookup_open()
3416 if (IS_ERR(dentry)) in lookup_open()
3417 return dentry; in lookup_open()
3419 if (d_in_lookup(dentry)) in lookup_open()
3422 error = d_revalidate(dentry, nd->flags); in lookup_open()
3427 d_invalidate(dentry); in lookup_open()
3428 dput(dentry); in lookup_open()
3429 dentry = NULL; in lookup_open()
3431 if (dentry->d_inode) { in lookup_open()
3433 return dentry; in lookup_open()
3454 dentry, mode); in lookup_open()
3461 dentry = atomic_open(nd, dentry, file, open_flag, mode); in lookup_open()
3462 if (unlikely(create_error) && dentry == ERR_PTR(-ENOENT)) in lookup_open()
3463 dentry = ERR_PTR(create_error); in lookup_open()
3464 return dentry; in lookup_open()
3467 if (d_in_lookup(dentry)) { in lookup_open()
3468 struct dentry *res = dir_inode->i_op->lookup(dir_inode, dentry, in lookup_open()
3470 d_lookup_done(dentry); in lookup_open()
3476 dput(dentry); in lookup_open()
3477 dentry = res; in lookup_open()
3482 if (!dentry->d_inode && (open_flag & O_CREAT)) { in lookup_open()
3484 audit_inode_child(dir_inode, dentry, AUDIT_TYPE_CHILD_CREATE); in lookup_open()
3490 error = dir_inode->i_op->create(idmap, dir_inode, dentry, in lookup_open()
3495 if (unlikely(create_error) && !dentry->d_inode) { in lookup_open()
3499 return dentry; in lookup_open()
3502 dput(dentry); in lookup_open()
3509 struct dentry *dir = nd->path.dentry; in open_last_lookups()
3512 struct dentry *dentry; in open_last_lookups() local
3527 dentry = lookup_fast(nd); in open_last_lookups()
3528 if (IS_ERR(dentry)) in open_last_lookups()
3529 return ERR_CAST(dentry); in open_last_lookups()
3530 if (likely(dentry)) in open_last_lookups()
3558 dentry = lookup_open(nd, file, op, got_write); in open_last_lookups()
3559 if (!IS_ERR(dentry) && (file->f_mode & FMODE_CREATED)) in open_last_lookups()
3560 fsnotify_create(dir->d_inode, dentry); in open_last_lookups()
3569 if (IS_ERR(dentry)) in open_last_lookups()
3570 return ERR_CAST(dentry); in open_last_lookups()
3573 dput(nd->path.dentry); in open_last_lookups()
3574 nd->path.dentry = dentry; in open_last_lookups()
3581 res = step_into(nd, WALK_TRAILING, dentry); in open_last_lookups()
3605 audit_inode(nd->name, nd->path.dentry, 0); in do_open()
3610 if (d_is_dir(nd->path.dentry)) in do_open()
3613 d_backing_inode(nd->path.dentry)); in do_open()
3617 if ((nd->flags & LOOKUP_DIRECTORY) && !d_can_lookup(nd->path.dentry)) in do_open()
3626 } else if (d_is_reg(nd->path.dentry) && open_flag & O_TRUNC) { in do_open()
3667 struct dentry *child; in vfs_tmpfile()
3668 struct inode *dir = d_inode(parentpath->dentry); in vfs_tmpfile()
3679 child = d_alloc(parentpath->dentry, &slash_name); in vfs_tmpfile()
3683 file->f_path.dentry = child; in vfs_tmpfile()
3751 audit_inode(nd->name, file->f_path.dentry, 0); in do_tmpfile()
3764 audit_inode(nd->name, path.dentry, 0); in do_o_path()
3835 if (d_is_symlink(root->dentry) && op->intent & LOOKUP_OPEN) in do_file_open_root()
3853 static struct dentry *filename_create(int dfd, struct filename *name, in filename_create()
3856 struct dentry *dentry = ERR_PTR(-EEXIST); in filename_create() local
3884 inode_lock_nested(path->dentry->d_inode, I_MUTEX_PARENT); in filename_create()
3885 dentry = lookup_one_qstr_excl(&last, path->dentry, in filename_create()
3887 if (IS_ERR(dentry)) in filename_create()
3891 if (d_is_positive(dentry)) in filename_create()
3908 return dentry; in filename_create()
3910 dput(dentry); in filename_create()
3911 dentry = ERR_PTR(error); in filename_create()
3913 inode_unlock(path->dentry->d_inode); in filename_create()
3918 return dentry; in filename_create()
3921 struct dentry *kern_path_create(int dfd, const char *pathname, in kern_path_create()
3925 struct dentry *res = filename_create(dfd, filename, path, lookup_flags); in kern_path_create()
3932 void done_path_create(struct path *path, struct dentry *dentry) in done_path_create() argument
3934 dput(dentry); in done_path_create()
3935 inode_unlock(path->dentry->d_inode); in done_path_create()
3941 inline struct dentry *user_path_create(int dfd, const char __user *pathname, in user_path_create()
3945 struct dentry *res = filename_create(dfd, filename, path, lookup_flags); in user_path_create()
3969 struct dentry *dentry, umode_t mode, dev_t dev) in vfs_mknod() argument
3972 int error = may_create(idmap, dir, dentry); in vfs_mknod()
3989 error = security_inode_mknod(dir, dentry, mode, dev); in vfs_mknod()
3993 error = dir->i_op->mknod(idmap, dir, dentry, mode, dev); in vfs_mknod()
3995 fsnotify_create(dir, dentry); in vfs_mknod()
4021 struct dentry *dentry; in do_mknodat() local
4030 dentry = filename_create(dfd, name, &path, lookup_flags); in do_mknodat()
4031 error = PTR_ERR(dentry); in do_mknodat()
4032 if (IS_ERR(dentry)) in do_mknodat()
4035 error = security_path_mknod(&path, dentry, in do_mknodat()
4036 mode_strip_umask(path.dentry->d_inode, mode), dev); in do_mknodat()
4043 error = vfs_create(idmap, path.dentry->d_inode, in do_mknodat()
4044 dentry, mode, true); in do_mknodat()
4046 ima_post_path_mknod(idmap, dentry); in do_mknodat()
4049 error = vfs_mknod(idmap, path.dentry->d_inode, in do_mknodat()
4050 dentry, mode, new_decode_dev(dev)); in do_mknodat()
4053 error = vfs_mknod(idmap, path.dentry->d_inode, in do_mknodat()
4054 dentry, mode, 0); in do_mknodat()
4058 done_path_create(&path, dentry); in do_mknodat()
4095 struct dentry *dentry, umode_t mode) in vfs_mkdir() argument
4100 error = may_create(idmap, dir, dentry); in vfs_mkdir()
4108 error = security_inode_mkdir(dir, dentry, mode); in vfs_mkdir()
4115 error = dir->i_op->mkdir(idmap, dir, dentry, mode); in vfs_mkdir()
4117 fsnotify_mkdir(dir, dentry); in vfs_mkdir()
4124 struct dentry *dentry; in do_mkdirat() local
4130 dentry = filename_create(dfd, name, &path, lookup_flags); in do_mkdirat()
4131 error = PTR_ERR(dentry); in do_mkdirat()
4132 if (IS_ERR(dentry)) in do_mkdirat()
4135 error = security_path_mkdir(&path, dentry, in do_mkdirat()
4136 mode_strip_umask(path.dentry->d_inode, mode)); in do_mkdirat()
4138 error = vfs_mkdir(mnt_idmap(path.mnt), path.dentry->d_inode, in do_mkdirat()
4139 dentry, mode); in do_mkdirat()
4141 done_path_create(&path, dentry); in do_mkdirat()
4176 struct dentry *dentry) in vfs_rmdir() argument
4178 int error = may_delete(idmap, dir, dentry, 1); in vfs_rmdir()
4186 dget(dentry); in vfs_rmdir()
4187 inode_lock(dentry->d_inode); in vfs_rmdir()
4190 if (is_local_mountpoint(dentry) || in vfs_rmdir()
4191 (dentry->d_inode->i_flags & S_KERNEL_FILE)) in vfs_rmdir()
4194 error = security_inode_rmdir(dir, dentry); in vfs_rmdir()
4198 error = dir->i_op->rmdir(dir, dentry); in vfs_rmdir()
4202 shrink_dcache_parent(dentry); in vfs_rmdir()
4203 dentry->d_inode->i_flags |= S_DEAD; in vfs_rmdir()
4204 dont_mount(dentry); in vfs_rmdir()
4205 detach_mounts(dentry); in vfs_rmdir()
4208 inode_unlock(dentry->d_inode); in vfs_rmdir()
4209 dput(dentry); in vfs_rmdir()
4211 d_delete_notify(dir, dentry); in vfs_rmdir()
4219 struct dentry *dentry; in do_rmdir() local
4245 inode_lock_nested(path.dentry->d_inode, I_MUTEX_PARENT); in do_rmdir()
4246 dentry = lookup_one_qstr_excl(&last, path.dentry, lookup_flags); in do_rmdir()
4247 error = PTR_ERR(dentry); in do_rmdir()
4248 if (IS_ERR(dentry)) in do_rmdir()
4250 if (!dentry->d_inode) { in do_rmdir()
4254 error = security_path_rmdir(&path, dentry); in do_rmdir()
4257 error = vfs_rmdir(mnt_idmap(path.mnt), path.dentry->d_inode, dentry); in do_rmdir()
4259 dput(dentry); in do_rmdir()
4261 inode_unlock(path.dentry->d_inode); in do_rmdir()
4305 struct dentry *dentry, struct inode **delegated_inode) in vfs_unlink() argument
4307 struct inode *target = dentry->d_inode; in vfs_unlink()
4308 int error = may_delete(idmap, dir, dentry, 0); in vfs_unlink()
4319 else if (is_local_mountpoint(dentry)) in vfs_unlink()
4322 error = security_inode_unlink(dir, dentry); in vfs_unlink()
4327 error = dir->i_op->unlink(dir, dentry); in vfs_unlink()
4329 dont_mount(dentry); in vfs_unlink()
4330 detach_mounts(dentry); in vfs_unlink()
4338 if (!error && dentry->d_flags & DCACHE_NFSFS_RENAMED) { in vfs_unlink()
4339 fsnotify_unlink(dir, dentry); in vfs_unlink()
4342 d_delete_notify(dir, dentry); in vfs_unlink()
4358 struct dentry *dentry; in do_unlinkat() local
4378 inode_lock_nested(path.dentry->d_inode, I_MUTEX_PARENT); in do_unlinkat()
4379 dentry = lookup_one_qstr_excl(&last, path.dentry, lookup_flags); in do_unlinkat()
4380 error = PTR_ERR(dentry); in do_unlinkat()
4381 if (!IS_ERR(dentry)) { in do_unlinkat()
4386 inode = dentry->d_inode; in do_unlinkat()
4387 if (d_is_negative(dentry)) in do_unlinkat()
4390 error = security_path_unlink(&path, dentry); in do_unlinkat()
4393 error = vfs_unlink(mnt_idmap(path.mnt), path.dentry->d_inode, in do_unlinkat()
4394 dentry, &delegated_inode); in do_unlinkat()
4396 dput(dentry); in do_unlinkat()
4398 inode_unlock(path.dentry->d_inode); in do_unlinkat()
4420 if (d_is_negative(dentry)) in do_unlinkat()
4422 else if (d_is_dir(dentry)) in do_unlinkat()
4460 struct dentry *dentry, const char *oldname) in vfs_symlink() argument
4464 error = may_create(idmap, dir, dentry); in vfs_symlink()
4471 error = security_inode_symlink(dir, dentry, oldname); in vfs_symlink()
4475 error = dir->i_op->symlink(idmap, dir, dentry, oldname); in vfs_symlink()
4477 fsnotify_create(dir, dentry); in vfs_symlink()
4485 struct dentry *dentry; in do_symlinkat() local
4494 dentry = filename_create(newdfd, to, &path, lookup_flags); in do_symlinkat()
4495 error = PTR_ERR(dentry); in do_symlinkat()
4496 if (IS_ERR(dentry)) in do_symlinkat()
4499 error = security_path_symlink(&path, dentry, from->name); in do_symlinkat()
4501 error = vfs_symlink(mnt_idmap(path.mnt), path.dentry->d_inode, in do_symlinkat()
4502 dentry, from->name); in do_symlinkat()
4503 done_path_create(&path, dentry); in do_symlinkat()
4551 int vfs_link(struct dentry *old_dentry, struct mnt_idmap *idmap, in vfs_link()
4552 struct inode *dir, struct dentry *new_dentry, in vfs_link()
4627 struct dentry *new_dentry; in do_linkat()
4667 error = security_path_link(old_path.dentry, &new_path, new_dentry); in do_linkat()
4670 error = vfs_link(old_path.dentry, idmap, new_path.dentry->d_inode, in do_linkat()
4757 struct dentry *old_dentry = rd->old_dentry; in vfs_rename()
4758 struct dentry *new_dentry = rd->new_dentry; in vfs_rename()
4917 struct dentry *old_dentry, *new_dentry; in do_renameat2()
4918 struct dentry *trap; in do_renameat2()
4966 trap = lock_rename(new_path.dentry, old_path.dentry); in do_renameat2()
4968 old_dentry = lookup_one_qstr_excl(&old_last, old_path.dentry, in do_renameat2()
4977 new_dentry = lookup_one_qstr_excl(&new_last, new_path.dentry, in do_renameat2()
5019 rd.old_dir = old_path.dentry->d_inode; in do_renameat2()
5022 rd.new_dir = new_path.dentry->d_inode; in do_renameat2()
5033 unlock_rename(new_path.dentry, old_path.dentry); in do_renameat2()
5102 int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen) in vfs_readlink() argument
5104 struct inode *inode = d_inode(dentry); in vfs_readlink()
5111 return inode->i_op->readlink(dentry, buffer, buflen); in vfs_readlink()
5113 if (!d_is_symlink(dentry)) in vfs_readlink()
5123 link = inode->i_op->get_link(dentry, inode, &done); in vfs_readlink()
5144 const char *vfs_get_link(struct dentry *dentry, struct delayed_call *done) in vfs_get_link() argument
5147 struct inode *inode = d_inode(dentry); in vfs_get_link()
5149 if (d_is_symlink(dentry)) { in vfs_get_link()
5150 res = ERR_PTR(security_inode_readlink(dentry)); in vfs_get_link()
5152 res = inode->i_op->get_link(dentry, inode, done); in vfs_get_link()
5159 const char *page_get_link(struct dentry *dentry, struct inode *inode, in page_get_link() argument
5166 if (!dentry) { in page_get_link()
5194 int page_readlink(struct dentry *dentry, char __user *buffer, int buflen) in page_readlink() argument
5198 page_get_link(dentry, d_inode(dentry), in page_readlink()