Lines Matching refs:dentry

545 	dget(path->dentry);  in path_get()
557 dput(path->dentry); in path_put()
599 p->path.dentry = NULL; in __set_nameidata()
646 static bool path_connected(struct vfsmount *mnt, struct dentry *dentry) in path_connected() argument
654 return is_subdir(dentry, mnt->mnt_root); in path_connected()
685 nd->path.dentry = NULL; in terminate_walk()
695 path->dentry = NULL; in __legitimize_path()
698 if (unlikely(!lockref_get_not_dead(&path->dentry->d_lockref))) { in __legitimize_path()
699 path->dentry = NULL; in __legitimize_path()
702 return !read_seqcount_retry(&path->dentry->d_seq, seq); in __legitimize_path()
770 struct dentry *parent = nd->path.dentry; in try_to_unlazy()
787 nd->path.dentry = NULL; in try_to_unlazy()
806 static bool try_to_unlazy_next(struct nameidata *nd, struct dentry *dentry, unsigned seq) in try_to_unlazy_next() argument
815 if (unlikely(!lockref_get_not_dead(&nd->path.dentry->d_lockref))) in try_to_unlazy_next()
825 if (unlikely(!lockref_get_not_dead(&dentry->d_lockref))) in try_to_unlazy_next()
827 if (unlikely(read_seqcount_retry(&dentry->d_seq, seq))) in try_to_unlazy_next()
841 nd->path.dentry = NULL; in try_to_unlazy_next()
847 dput(dentry); in try_to_unlazy_next()
851 static inline int d_revalidate(struct dentry *dentry, unsigned int flags) in d_revalidate() argument
853 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) in d_revalidate()
854 return dentry->d_op->d_revalidate(dentry, flags); in d_revalidate()
871 struct dentry *dentry = nd->path.dentry; in complete_walk() local
911 if (likely(!(dentry->d_flags & DCACHE_OP_WEAK_REVALIDATE))) in complete_walk()
914 status = dentry->d_op->d_weak_revalidate(dentry, nd->flags); in complete_walk()
942 nd->root_seq = __read_seqcount_begin(&nd->root.dentry->d_seq); in set_root()
966 struct dentry *d; in nd_jump_root()
968 d = nd->path.dentry; in nd_jump_root()
977 nd->inode = nd->path.dentry->d_inode; in nd_jump_root()
1006 nd->inode = nd->path.dentry->d_inode; in nd_jump_link()
1068 audit_inode(nd->name, nd->stack[0].link.dentry, 0); in may_follow_link()
1131 struct inode *inode = link->dentry->d_inode; in may_linkat()
1219 struct dentry *mountpoint; in follow_up()
1230 dput(path->dentry); in follow_up()
1231 path->dentry = mountpoint; in follow_up()
1242 struct dentry *mountpoint = m->mnt_mountpoint; in choose_mountpoint_rcu()
1245 if (unlikely(root->dentry == mountpoint && in choose_mountpoint_rcu()
1250 path->dentry = mountpoint; in choose_mountpoint_rcu()
1290 struct dentry *dentry = path->dentry; in follow_automount() local
1305 dentry->d_inode) in follow_automount()
1311 return finish_automount(dentry->d_op->d_automount(path), path); in follow_automount()
1331 ret = path->dentry->d_op->d_manage(path, false); in __traverse_mounts()
1332 flags = smp_load_acquire(&path->dentry->d_flags); in __traverse_mounts()
1340 dput(path->dentry); in __traverse_mounts()
1344 path->dentry = dget(mounted->mnt_root); in __traverse_mounts()
1346 flags = path->dentry->d_flags; in __traverse_mounts()
1357 flags = smp_load_acquire(&path->dentry->d_flags); in __traverse_mounts()
1376 unsigned flags = smp_load_acquire(&path->dentry->d_flags); in traverse_mounts()
1394 dput(path->dentry); in follow_down_one()
1397 path->dentry = dget(mounted->mnt_root); in follow_down_one()
1428 struct dentry *dentry = path->dentry; in __follow_mount_rcu() local
1429 unsigned int flags = dentry->d_flags; in __follow_mount_rcu()
1443 int res = dentry->d_op->d_manage(path, true); in __follow_mount_rcu()
1446 flags = dentry->d_flags; in __follow_mount_rcu()
1450 struct mount *mounted = __lookup_mnt(path->mnt, dentry); in __follow_mount_rcu()
1453 dentry = path->dentry = mounted->mnt.mnt_root; in __follow_mount_rcu()
1455 *seqp = read_seqcount_begin(&dentry->d_seq); in __follow_mount_rcu()
1456 *inode = dentry->d_inode; in __follow_mount_rcu()
1463 flags = dentry->d_flags; in __follow_mount_rcu()
1473 static inline int handle_mounts(struct nameidata *nd, struct dentry *dentry, in handle_mounts() argument
1481 path->dentry = dentry; in handle_mounts()
1488 if (!try_to_unlazy_next(nd, dentry, seq)) in handle_mounts()
1492 path->dentry = dentry; in handle_mounts()
1502 dput(path->dentry); in handle_mounts()
1506 *inode = d_backing_inode(path->dentry); in handle_mounts()
1516 static struct dentry *lookup_dcache(const struct qstr *name, in lookup_dcache()
1517 struct dentry *dir, in lookup_dcache()
1520 struct dentry *dentry = d_lookup(dir, name); in lookup_dcache() local
1521 if (dentry) { in lookup_dcache()
1522 int error = d_revalidate(dentry, flags); in lookup_dcache()
1525 d_invalidate(dentry); in lookup_dcache()
1526 dput(dentry); in lookup_dcache()
1530 return dentry; in lookup_dcache()
1540 static struct dentry *__lookup_hash(const struct qstr *name, in __lookup_hash()
1541 struct dentry *base, unsigned int flags) in __lookup_hash()
1543 struct dentry *dentry = lookup_dcache(name, base, flags); in __lookup_hash() local
1544 struct dentry *old; in __lookup_hash()
1547 if (dentry) in __lookup_hash()
1548 return dentry; in __lookup_hash()
1554 dentry = d_alloc(base, name); in __lookup_hash()
1555 if (unlikely(!dentry)) in __lookup_hash()
1558 old = dir->i_op->lookup(dir, dentry, flags); in __lookup_hash()
1560 dput(dentry); in __lookup_hash()
1561 dentry = old; in __lookup_hash()
1563 return dentry; in __lookup_hash()
1566 static struct dentry *lookup_fast(struct nameidata *nd, in lookup_fast()
1570 struct dentry *dentry, *parent = nd->path.dentry; in lookup_fast() local
1580 dentry = __d_lookup_rcu(parent, &nd->last, &seq); in lookup_fast()
1581 if (unlikely(!dentry)) { in lookup_fast()
1591 *inode = d_backing_inode(dentry); in lookup_fast()
1592 if (unlikely(read_seqcount_retry(&dentry->d_seq, seq))) in lookup_fast()
1606 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1608 return dentry; in lookup_fast()
1609 if (!try_to_unlazy_next(nd, dentry, seq)) in lookup_fast()
1613 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1615 dentry = __d_lookup(parent, &nd->last); in lookup_fast()
1616 if (unlikely(!dentry)) in lookup_fast()
1618 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1622 d_invalidate(dentry); in lookup_fast()
1623 dput(dentry); in lookup_fast()
1626 return dentry; in lookup_fast()
1630 static struct dentry *__lookup_slow(const struct qstr *name, in __lookup_slow()
1631 struct dentry *dir, in __lookup_slow()
1634 struct dentry *dentry, *old; in __lookup_slow() local
1642 dentry = d_alloc_parallel(dir, name, &wq); in __lookup_slow()
1643 if (IS_ERR(dentry)) in __lookup_slow()
1644 return dentry; in __lookup_slow()
1645 if (unlikely(!d_in_lookup(dentry))) { in __lookup_slow()
1646 int error = d_revalidate(dentry, flags); in __lookup_slow()
1649 d_invalidate(dentry); in __lookup_slow()
1650 dput(dentry); in __lookup_slow()
1653 dput(dentry); in __lookup_slow()
1654 dentry = ERR_PTR(error); in __lookup_slow()
1657 old = inode->i_op->lookup(inode, dentry, flags); in __lookup_slow()
1658 d_lookup_done(dentry); in __lookup_slow()
1660 dput(dentry); in __lookup_slow()
1661 dentry = old; in __lookup_slow()
1664 return dentry; in __lookup_slow()
1667 static struct dentry *lookup_slow(const struct qstr *name, in lookup_slow()
1668 struct dentry *dir, in lookup_slow()
1672 struct dentry *res; in lookup_slow()
1754 error = security_inode_follow_link(link->dentry, inode, in pick_link()
1761 const char * (*get)(struct dentry *, struct inode *, in pick_link()
1767 res = get(link->dentry, inode, &last->done); in pick_link()
1769 res = get(link->dentry, inode, &last->done); in pick_link()
1797 struct dentry *dentry, struct inode *inode, unsigned seq) in step_into() argument
1800 int err = handle_mounts(nd, dentry, &path, &inode, &seq); in step_into()
1804 if (likely(!d_is_symlink(path.dentry)) || in step_into()
1809 dput(nd->path.dentry); in step_into()
1820 if (read_seqcount_retry(&path.dentry->d_seq, seq)) in step_into()
1829 static struct dentry *follow_dotdot_rcu(struct nameidata *nd, in follow_dotdot_rcu()
1833 struct dentry *parent, *old; in follow_dotdot_rcu()
1837 if (unlikely(nd->path.dentry == nd->path.mnt->mnt_root)) { in follow_dotdot_rcu()
1846 nd->inode = path.dentry->d_inode; in follow_dotdot_rcu()
1852 old = nd->path.dentry; in follow_dotdot_rcu()
1869 static struct dentry *follow_dotdot(struct nameidata *nd, in follow_dotdot()
1873 struct dentry *parent; in follow_dotdot()
1877 if (unlikely(nd->path.dentry == nd->path.mnt->mnt_root)) { in follow_dotdot()
1885 nd->inode = path.dentry->d_inode; in follow_dotdot()
1890 parent = dget_parent(nd->path.dentry); in follow_dotdot()
1902 dget(nd->path.dentry); in follow_dotdot()
1910 struct dentry *parent; in handle_dots()
1927 nd->path.dentry, nd->inode, nd->seq); in handle_dots()
1953 struct dentry *dentry; in walk_component() local
1966 dentry = lookup_fast(nd, &inode, &seq); in walk_component()
1967 if (IS_ERR(dentry)) in walk_component()
1968 return ERR_CAST(dentry); in walk_component()
1969 if (unlikely(!dentry)) { in walk_component()
1970 dentry = lookup_slow(&nd->last, nd->path.dentry, nd->flags); in walk_component()
1971 if (IS_ERR(dentry)) in walk_component()
1972 return ERR_CAST(dentry); in walk_component()
1976 return step_into(nd, flags, dentry, inode, seq); in walk_component()
2243 hash_len = hash_name(nd->path.dentry, name); in link_path_walk()
2257 struct dentry *parent = nd->path.dentry; in link_path_walk()
2307 if (unlikely(!d_can_lookup(nd->path.dentry))) { in link_path_walk()
2340 struct dentry *root = nd->root.dentry; in path_init()
2347 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
2374 nd->inode = nd->path.dentry->d_inode; in path_init()
2375 nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
2379 nd->inode = nd->path.dentry->d_inode; in path_init()
2384 struct dentry *dentry; in path_init() local
2389 dentry = f.file->f_path.dentry; in path_init()
2391 if (*s && unlikely(!d_can_lookup(dentry))) { in path_init()
2398 nd->inode = nd->path.dentry->d_inode; in path_init()
2399 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
2402 nd->inode = nd->path.dentry->d_inode; in path_init()
2431 dget(nd->path.dentry); in handle_lookup_down()
2433 nd->path.dentry, nd->inode, nd->seq)); in handle_lookup_down()
2459 if (!d_can_lookup(nd->path.dentry)) in path_lookupat()
2464 nd->path.dentry = NULL; in path_lookupat()
2485 audit_inode(name, path->dentry, in filename_lookup()
2502 nd->path.dentry = NULL; in path_parentat()
2527 audit_inode(name, parent->dentry, AUDIT_INODE_PARENT); in filename_parentat()
2534 static struct dentry *__kern_path_locked(struct filename *name, struct path *path) in __kern_path_locked()
2536 struct dentry *d; in __kern_path_locked()
2547 inode_lock_nested(path->dentry->d_inode, I_MUTEX_PARENT); in __kern_path_locked()
2548 d = __lookup_hash(&last, path->dentry, 0); in __kern_path_locked()
2550 inode_unlock(path->dentry->d_inode); in __kern_path_locked()
2556 struct dentry *kern_path_locked(const char *name, struct path *path) in kern_path_locked()
2559 struct dentry *res = __kern_path_locked(filename, path); in kern_path_locked()
2584 int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, in vfs_path_lookup() argument
2589 struct path root = {.mnt = mnt, .dentry = dentry}; in vfs_path_lookup()
2601 const char *name, struct dentry *base, int len, in lookup_one_common()
2647 struct dentry *try_lookup_one_len(const char *name, struct dentry *base, int len) in try_lookup_one_len()
2673 struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) in lookup_one_len()
2675 struct dentry *dentry; in lookup_one_len() local
2685 dentry = lookup_dcache(&this, base, 0); in lookup_one_len()
2686 return dentry ? dentry : __lookup_slow(&this, base, 0); in lookup_one_len()
2702 struct dentry *lookup_one(struct user_namespace *mnt_userns, const char *name, in lookup_one()
2703 struct dentry *base, int len) in lookup_one()
2705 struct dentry *dentry; in lookup_one() local
2715 dentry = lookup_dcache(&this, base, 0); in lookup_one()
2716 return dentry ? dentry : __lookup_slow(&this, base, 0); in lookup_one()
2732 struct dentry *lookup_one_len_unlocked(const char *name, in lookup_one_len_unlocked()
2733 struct dentry *base, int len) in lookup_one_len_unlocked()
2737 struct dentry *ret; in lookup_one_len_unlocked()
2758 struct dentry *lookup_positive_unlocked(const char *name, in lookup_positive_unlocked()
2759 struct dentry *base, int len) in lookup_positive_unlocked()
2761 struct dentry *ret = lookup_one_len_unlocked(name, base, len); in lookup_positive_unlocked()
2776 struct dentry *parent = dget_parent(path->dentry); in path_pts()
2777 struct dentry *child; in path_pts()
2784 dput(path->dentry); in path_pts()
2785 path->dentry = parent; in path_pts()
2790 path->dentry = child; in path_pts()
2842 struct dentry *victim, bool isdir) in may_delete()
2894 struct inode *dir, struct dentry *child) in may_create()
2910 struct dentry *lock_rename(struct dentry *p1, struct dentry *p2) in lock_rename()
2912 struct dentry *p; in lock_rename()
2941 void unlock_rename(struct dentry *p1, struct dentry *p2) in unlock_rename()
2968 struct dentry *dentry, umode_t mode, bool want_excl) in vfs_create() argument
2970 int error = may_create(mnt_userns, dir, dentry); in vfs_create()
2978 error = security_inode_create(dir, dentry, mode); in vfs_create()
2981 error = dir->i_op->create(mnt_userns, dir, dentry, mode, want_excl); in vfs_create()
2983 fsnotify_create(dir, dentry); in vfs_create()
2988 int vfs_mkobj(struct dentry *dentry, umode_t mode, in vfs_mkobj() argument
2989 int (*f)(struct dentry *, umode_t, void *), in vfs_mkobj() argument
2992 struct inode *dir = dentry->d_parent->d_inode; in vfs_mkobj()
2993 int error = may_create(&init_user_ns, dir, dentry); in vfs_mkobj()
2999 error = security_inode_create(dir, dentry, mode); in vfs_mkobj()
3002 error = f(dentry, mode, arg); in vfs_mkobj()
3004 fsnotify_create(dir, dentry); in vfs_mkobj()
3018 struct dentry *dentry = path->dentry; in may_open() local
3019 struct inode *inode = dentry->d_inode; in may_open()
3075 struct inode *inode = path->dentry->d_inode; in handle_truncate()
3084 error = do_truncate(mnt_userns, path->dentry, 0, in handle_truncate()
3100 const struct path *dir, struct dentry *dentry, in may_o_create() argument
3103 int error = security_path_mknod(dir, dentry, mode, 0); in may_o_create()
3107 if (!fsuidgid_has_mapping(dir->dentry->d_sb, mnt_userns)) in may_o_create()
3110 error = inode_permission(mnt_userns, dir->dentry->d_inode, in may_o_create()
3115 return security_inode_create(dir->dentry->d_inode, dentry, mode); in may_o_create()
3131 static struct dentry *atomic_open(struct nameidata *nd, struct dentry *dentry, in atomic_open() argument
3135 struct dentry *const DENTRY_NOT_SET = (void *) -1UL; in atomic_open()
3136 struct inode *dir = nd->path.dentry->d_inode; in atomic_open()
3142 file->f_path.dentry = DENTRY_NOT_SET; in atomic_open()
3144 error = dir->i_op->atomic_open(dir, dentry, file, in atomic_open()
3146 d_lookup_done(dentry); in atomic_open()
3149 if (unlikely(dentry != file->f_path.dentry)) { in atomic_open()
3150 dput(dentry); in atomic_open()
3151 dentry = dget(file->f_path.dentry); in atomic_open()
3153 } else if (WARN_ON(file->f_path.dentry == DENTRY_NOT_SET)) { in atomic_open()
3156 if (file->f_path.dentry) { in atomic_open()
3157 dput(dentry); in atomic_open()
3158 dentry = file->f_path.dentry; in atomic_open()
3160 if (unlikely(d_is_negative(dentry))) in atomic_open()
3165 dput(dentry); in atomic_open()
3166 dentry = ERR_PTR(error); in atomic_open()
3168 return dentry; in atomic_open()
3186 static struct dentry *lookup_open(struct nameidata *nd, struct file *file, in lookup_open()
3191 struct dentry *dir = nd->path.dentry; in lookup_open()
3194 struct dentry *dentry; in lookup_open() local
3203 dentry = d_lookup(dir, &nd->last); in lookup_open()
3205 if (!dentry) { in lookup_open()
3206 dentry = d_alloc_parallel(dir, &nd->last, &wq); in lookup_open()
3207 if (IS_ERR(dentry)) in lookup_open()
3208 return dentry; in lookup_open()
3210 if (d_in_lookup(dentry)) in lookup_open()
3213 error = d_revalidate(dentry, nd->flags); in lookup_open()
3218 d_invalidate(dentry); in lookup_open()
3219 dput(dentry); in lookup_open()
3220 dentry = NULL; in lookup_open()
3222 if (dentry->d_inode) { in lookup_open()
3224 return dentry; in lookup_open()
3246 dentry, mode); in lookup_open()
3253 dentry = atomic_open(nd, dentry, file, open_flag, mode); in lookup_open()
3254 if (unlikely(create_error) && dentry == ERR_PTR(-ENOENT)) in lookup_open()
3255 dentry = ERR_PTR(create_error); in lookup_open()
3256 return dentry; in lookup_open()
3259 if (d_in_lookup(dentry)) { in lookup_open()
3260 struct dentry *res = dir_inode->i_op->lookup(dir_inode, dentry, in lookup_open()
3262 d_lookup_done(dentry); in lookup_open()
3268 dput(dentry); in lookup_open()
3269 dentry = res; in lookup_open()
3274 if (!dentry->d_inode && (open_flag & O_CREAT)) { in lookup_open()
3276 audit_inode_child(dir_inode, dentry, AUDIT_TYPE_CHILD_CREATE); in lookup_open()
3282 error = dir_inode->i_op->create(mnt_userns, dir_inode, dentry, in lookup_open()
3287 if (unlikely(create_error) && !dentry->d_inode) { in lookup_open()
3291 return dentry; in lookup_open()
3294 dput(dentry); in lookup_open()
3301 struct dentry *dir = nd->path.dentry; in open_last_lookups()
3306 struct dentry *dentry; in open_last_lookups() local
3321 dentry = lookup_fast(nd, &inode, &seq); in open_last_lookups()
3322 if (IS_ERR(dentry)) in open_last_lookups()
3323 return ERR_CAST(dentry); in open_last_lookups()
3324 if (likely(dentry)) in open_last_lookups()
3352 dentry = lookup_open(nd, file, op, got_write); in open_last_lookups()
3353 if (!IS_ERR(dentry) && (file->f_mode & FMODE_CREATED)) in open_last_lookups()
3354 fsnotify_create(dir->d_inode, dentry); in open_last_lookups()
3363 if (IS_ERR(dentry)) in open_last_lookups()
3364 return ERR_CAST(dentry); in open_last_lookups()
3367 dput(nd->path.dentry); in open_last_lookups()
3368 nd->path.dentry = dentry; in open_last_lookups()
3375 res = step_into(nd, WALK_TRAILING, dentry, inode, seq); in open_last_lookups()
3399 audit_inode(nd->name, nd->path.dentry, 0); in do_open()
3404 if (d_is_dir(nd->path.dentry)) in do_open()
3407 d_backing_inode(nd->path.dentry)); in do_open()
3411 if ((nd->flags & LOOKUP_DIRECTORY) && !d_can_lookup(nd->path.dentry)) in do_open()
3420 } else if (d_is_reg(nd->path.dentry) && open_flag & O_TRUNC) { in do_open()
3457 struct dentry *vfs_tmpfile(struct user_namespace *mnt_userns, in vfs_tmpfile()
3458 struct dentry *dentry, umode_t mode, int open_flag) in vfs_tmpfile() argument
3460 struct dentry *child = NULL; in vfs_tmpfile()
3461 struct inode *dir = dentry->d_inode; in vfs_tmpfile()
3473 child = d_alloc(dentry, &slash_name); in vfs_tmpfile()
3502 struct dentry *child; in do_tmpfile()
3511 child = vfs_tmpfile(mnt_userns, path.dentry, op->mode, op->open_flag); in do_tmpfile()
3515 dput(path.dentry); in do_tmpfile()
3516 path.dentry = child; in do_tmpfile()
3534 audit_inode(nd->name, path.dentry, 0); in do_o_path()
3605 if (d_is_symlink(root->dentry) && op->intent & LOOKUP_OPEN) in do_file_open_root()
3623 static struct dentry *filename_create(int dfd, struct filename *name, in filename_create()
3626 struct dentry *dentry = ERR_PTR(-EEXIST); in filename_create() local
3656 inode_lock_nested(path->dentry->d_inode, I_MUTEX_PARENT); in filename_create()
3657 dentry = __lookup_hash(&last, path->dentry, lookup_flags); in filename_create()
3658 if (IS_ERR(dentry)) in filename_create()
3662 if (d_is_positive(dentry)) in filename_create()
3679 return dentry; in filename_create()
3681 dput(dentry); in filename_create()
3682 dentry = ERR_PTR(error); in filename_create()
3684 inode_unlock(path->dentry->d_inode); in filename_create()
3689 return dentry; in filename_create()
3692 struct dentry *kern_path_create(int dfd, const char *pathname, in kern_path_create()
3696 struct dentry *res = filename_create(dfd, filename, path, lookup_flags); in kern_path_create()
3703 void done_path_create(struct path *path, struct dentry *dentry) in done_path_create() argument
3705 dput(dentry); in done_path_create()
3706 inode_unlock(path->dentry->d_inode); in done_path_create()
3712 inline struct dentry *user_path_create(int dfd, const char __user *pathname, in user_path_create()
3716 struct dentry *res = filename_create(dfd, filename, path, lookup_flags); in user_path_create()
3740 struct dentry *dentry, umode_t mode, dev_t dev) in vfs_mknod() argument
3743 int error = may_create(mnt_userns, dir, dentry); in vfs_mknod()
3759 error = security_inode_mknod(dir, dentry, mode, dev); in vfs_mknod()
3763 error = dir->i_op->mknod(mnt_userns, dir, dentry, mode, dev); in vfs_mknod()
3765 fsnotify_create(dir, dentry); in vfs_mknod()
3791 struct dentry *dentry; in do_mknodat() local
3800 dentry = filename_create(dfd, name, &path, lookup_flags); in do_mknodat()
3801 error = PTR_ERR(dentry); in do_mknodat()
3802 if (IS_ERR(dentry)) in do_mknodat()
3805 if (!IS_POSIXACL(path.dentry->d_inode)) in do_mknodat()
3807 error = security_path_mknod(&path, dentry, mode, dev); in do_mknodat()
3814 error = vfs_create(mnt_userns, path.dentry->d_inode, in do_mknodat()
3815 dentry, mode, true); in do_mknodat()
3817 ima_post_path_mknod(mnt_userns, dentry); in do_mknodat()
3820 error = vfs_mknod(mnt_userns, path.dentry->d_inode, in do_mknodat()
3821 dentry, mode, new_decode_dev(dev)); in do_mknodat()
3824 error = vfs_mknod(mnt_userns, path.dentry->d_inode, in do_mknodat()
3825 dentry, mode, 0); in do_mknodat()
3829 done_path_create(&path, dentry); in do_mknodat()
3866 struct dentry *dentry, umode_t mode) in vfs_mkdir() argument
3868 int error = may_create(mnt_userns, dir, dentry); in vfs_mkdir()
3878 error = security_inode_mkdir(dir, dentry, mode); in vfs_mkdir()
3885 error = dir->i_op->mkdir(mnt_userns, dir, dentry, mode); in vfs_mkdir()
3887 fsnotify_mkdir(dir, dentry); in vfs_mkdir()
3894 struct dentry *dentry; in do_mkdirat() local
3900 dentry = filename_create(dfd, name, &path, lookup_flags); in do_mkdirat()
3901 error = PTR_ERR(dentry); in do_mkdirat()
3902 if (IS_ERR(dentry)) in do_mkdirat()
3905 if (!IS_POSIXACL(path.dentry->d_inode)) in do_mkdirat()
3907 error = security_path_mkdir(&path, dentry, mode); in do_mkdirat()
3911 error = vfs_mkdir(mnt_userns, path.dentry->d_inode, dentry, in do_mkdirat()
3914 done_path_create(&path, dentry); in do_mkdirat()
3949 struct dentry *dentry) in vfs_rmdir() argument
3951 int error = may_delete(mnt_userns, dir, dentry, 1); in vfs_rmdir()
3959 dget(dentry); in vfs_rmdir()
3960 inode_lock(dentry->d_inode); in vfs_rmdir()
3963 if (is_local_mountpoint(dentry)) in vfs_rmdir()
3966 error = security_inode_rmdir(dir, dentry); in vfs_rmdir()
3970 error = dir->i_op->rmdir(dir, dentry); in vfs_rmdir()
3974 shrink_dcache_parent(dentry); in vfs_rmdir()
3975 dentry->d_inode->i_flags |= S_DEAD; in vfs_rmdir()
3976 dont_mount(dentry); in vfs_rmdir()
3977 detach_mounts(dentry); in vfs_rmdir()
3978 fsnotify_rmdir(dir, dentry); in vfs_rmdir()
3981 inode_unlock(dentry->d_inode); in vfs_rmdir()
3982 dput(dentry); in vfs_rmdir()
3984 d_delete(dentry); in vfs_rmdir()
3993 struct dentry *dentry; in do_rmdir() local
4019 inode_lock_nested(path.dentry->d_inode, I_MUTEX_PARENT); in do_rmdir()
4020 dentry = __lookup_hash(&last, path.dentry, lookup_flags); in do_rmdir()
4021 error = PTR_ERR(dentry); in do_rmdir()
4022 if (IS_ERR(dentry)) in do_rmdir()
4024 if (!dentry->d_inode) { in do_rmdir()
4028 error = security_path_rmdir(&path, dentry); in do_rmdir()
4032 error = vfs_rmdir(mnt_userns, path.dentry->d_inode, dentry); in do_rmdir()
4034 dput(dentry); in do_rmdir()
4036 inode_unlock(path.dentry->d_inode); in do_rmdir()
4080 struct dentry *dentry, struct inode **delegated_inode) in vfs_unlink() argument
4082 struct inode *target = dentry->d_inode; in vfs_unlink()
4083 int error = may_delete(mnt_userns, dir, dentry, 0); in vfs_unlink()
4094 else if (is_local_mountpoint(dentry)) in vfs_unlink()
4097 error = security_inode_unlink(dir, dentry); in vfs_unlink()
4102 error = dir->i_op->unlink(dir, dentry); in vfs_unlink()
4104 dont_mount(dentry); in vfs_unlink()
4105 detach_mounts(dentry); in vfs_unlink()
4106 fsnotify_unlink(dir, dentry); in vfs_unlink()
4114 if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { in vfs_unlink()
4116 d_delete(dentry); in vfs_unlink()
4132 struct dentry *dentry; in do_unlinkat() local
4152 inode_lock_nested(path.dentry->d_inode, I_MUTEX_PARENT); in do_unlinkat()
4153 dentry = __lookup_hash(&last, path.dentry, lookup_flags); in do_unlinkat()
4154 error = PTR_ERR(dentry); in do_unlinkat()
4155 if (!IS_ERR(dentry)) { in do_unlinkat()
4161 inode = dentry->d_inode; in do_unlinkat()
4162 if (d_is_negative(dentry)) in do_unlinkat()
4165 error = security_path_unlink(&path, dentry); in do_unlinkat()
4169 error = vfs_unlink(mnt_userns, path.dentry->d_inode, dentry, in do_unlinkat()
4172 dput(dentry); in do_unlinkat()
4174 inode_unlock(path.dentry->d_inode); in do_unlinkat()
4196 if (d_is_negative(dentry)) in do_unlinkat()
4198 else if (d_is_dir(dentry)) in do_unlinkat()
4236 struct dentry *dentry, const char *oldname) in vfs_symlink() argument
4238 int error = may_create(mnt_userns, dir, dentry); in vfs_symlink()
4246 error = security_inode_symlink(dir, dentry, oldname); in vfs_symlink()
4250 error = dir->i_op->symlink(mnt_userns, dir, dentry, oldname); in vfs_symlink()
4252 fsnotify_create(dir, dentry); in vfs_symlink()
4260 struct dentry *dentry; in do_symlinkat() local
4269 dentry = filename_create(newdfd, to, &path, lookup_flags); in do_symlinkat()
4270 error = PTR_ERR(dentry); in do_symlinkat()
4271 if (IS_ERR(dentry)) in do_symlinkat()
4274 error = security_path_symlink(&path, dentry, from->name); in do_symlinkat()
4279 error = vfs_symlink(mnt_userns, path.dentry->d_inode, dentry, in do_symlinkat()
4282 done_path_create(&path, dentry); in do_symlinkat()
4330 int vfs_link(struct dentry *old_dentry, struct user_namespace *mnt_userns, in vfs_link()
4331 struct inode *dir, struct dentry *new_dentry, in vfs_link()
4406 struct dentry *new_dentry; in do_linkat()
4446 error = security_path_link(old_path.dentry, &new_path, new_dentry); in do_linkat()
4449 error = vfs_link(old_path.dentry, mnt_userns, new_path.dentry->d_inode, in do_linkat()
4535 struct dentry *old_dentry = rd->old_dentry; in vfs_rename()
4536 struct dentry *new_dentry = rd->new_dentry; in vfs_rename()
4671 struct dentry *old_dentry, *new_dentry; in do_renameat2()
4672 struct dentry *trap; in do_renameat2()
4720 trap = lock_rename(new_path.dentry, old_path.dentry); in do_renameat2()
4722 old_dentry = __lookup_hash(&old_last, old_path.dentry, lookup_flags); in do_renameat2()
4730 new_dentry = __lookup_hash(&new_last, new_path.dentry, lookup_flags | target_flags); in do_renameat2()
4771 rd.old_dir = old_path.dentry->d_inode; in do_renameat2()
4774 rd.new_dir = new_path.dentry->d_inode; in do_renameat2()
4785 unlock_rename(new_path.dentry, old_path.dentry); in do_renameat2()
4854 int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen) in vfs_readlink() argument
4856 struct inode *inode = d_inode(dentry); in vfs_readlink()
4863 return inode->i_op->readlink(dentry, buffer, buflen); in vfs_readlink()
4865 if (!d_is_symlink(dentry)) in vfs_readlink()
4875 link = inode->i_op->get_link(dentry, inode, &done); in vfs_readlink()
4896 const char *vfs_get_link(struct dentry *dentry, struct delayed_call *done) in vfs_get_link() argument
4899 struct inode *inode = d_inode(dentry); in vfs_get_link()
4901 if (d_is_symlink(dentry)) { in vfs_get_link()
4902 res = ERR_PTR(security_inode_readlink(dentry)); in vfs_get_link()
4904 res = inode->i_op->get_link(dentry, inode, done); in vfs_get_link()
4911 const char *page_get_link(struct dentry *dentry, struct inode *inode, in page_get_link() argument
4918 if (!dentry) { in page_get_link()
4946 int page_readlink(struct dentry *dentry, char __user *buffer, int buflen) in page_readlink() argument
4950 page_get_link(dentry, d_inode(dentry), in page_readlink()