Lines Matching refs:dentry
483 dget(path->dentry); in path_get()
495 dput(path->dentry); in path_put()
582 return is_subdir(path->dentry, mnt->mnt_root); in path_connected()
631 path->dentry = NULL; in legitimize_path()
634 if (unlikely(!lockref_get_not_dead(&path->dentry->d_lockref))) { in legitimize_path()
635 path->dentry = NULL; in legitimize_path()
638 return !read_seqcount_retry(&path->dentry->d_seq, seq); in legitimize_path()
687 struct dentry *parent = nd->path.dentry; in unlazy_walk()
704 nd->path.dentry = NULL; in unlazy_walk()
723 static int unlazy_child(struct nameidata *nd, struct dentry *dentry, unsigned seq) in unlazy_child() argument
732 if (unlikely(!lockref_get_not_dead(&nd->path.dentry->d_lockref))) in unlazy_child()
742 if (unlikely(!lockref_get_not_dead(&dentry->d_lockref))) in unlazy_child()
744 if (unlikely(read_seqcount_retry(&dentry->d_seq, seq))) in unlazy_child()
758 nd->path.dentry = NULL; in unlazy_child()
764 dput(dentry); in unlazy_child()
768 static inline int d_revalidate(struct dentry *dentry, unsigned int flags) in d_revalidate() argument
770 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) in d_revalidate()
771 return dentry->d_op->d_revalidate(dentry, flags); in d_revalidate()
863 struct dentry *dentry = nd->path.dentry; in complete_walk() local
878 if (likely(!(dentry->d_flags & DCACHE_OP_WEAK_REVALIDATE))) { in complete_walk()
883 status = dentry->d_op->d_weak_revalidate(dentry, nd->flags); in complete_walk()
905 nd->root_seq = __read_seqcount_begin(&nd->root.dentry->d_seq); in set_root()
915 dput(path->dentry); in path_put_conditional()
924 dput(nd->path.dentry); in path_to_nameidata()
929 nd->path.dentry = path->dentry; in path_to_nameidata()
935 struct dentry *d; in nd_jump_root()
937 d = nd->path.dentry; in nd_jump_root()
946 nd->inode = nd->path.dentry->d_inode; in nd_jump_root()
962 nd->inode = nd->path.dentry->d_inode; in nd_jump_link()
1021 audit_inode(nd->name, nd->stack[0].link.dentry, 0); in may_follow_link()
1075 struct inode *inode = link->dentry->d_inode; in may_linkat()
1138 struct dentry *dentry = last->link.dentry; in get_link() local
1152 error = security_inode_follow_link(dentry, inode, in get_link()
1160 const char * (*get)(struct dentry *, struct inode *, in get_link()
1168 res = get(dentry, inode, &last->done); in get_link()
1171 res = get(dentry, inode, &last->done); in get_link()
1203 struct dentry *mountpoint; in follow_up()
1214 dput(path->dentry); in follow_up()
1215 path->dentry = mountpoint; in follow_up()
1233 if (!path->dentry->d_op || !path->dentry->d_op->d_automount) in follow_automount()
1249 path->dentry->d_inode) in follow_automount()
1256 mnt = path->dentry->d_op->d_automount(path); in follow_automount()
1289 path->dentry = dget(mnt->mnt_root); in follow_automount()
1317 while (managed = READ_ONCE(path->dentry->d_flags), in follow_managed()
1323 BUG_ON(!path->dentry->d_op); in follow_managed()
1324 BUG_ON(!path->dentry->d_op->d_manage); in follow_managed()
1325 ret = path->dentry->d_op->d_manage(path, false); in follow_managed()
1334 dput(path->dentry); in follow_managed()
1338 path->dentry = dget(mounted->mnt_root); in follow_managed()
1378 dput(path->dentry); in follow_down_one()
1381 path->dentry = dget(mounted->mnt_root); in follow_down_one()
1390 return (path->dentry->d_flags & DCACHE_MANAGE_TRANSIT) ? in managed_dentry_rcu()
1391 path->dentry->d_op->d_manage(path, true) : 0; in managed_dentry_rcu()
1417 if (!d_mountpoint(path->dentry)) in __follow_mount_rcu()
1418 return !(path->dentry->d_flags & DCACHE_NEED_AUTOMOUNT); in __follow_mount_rcu()
1420 mounted = __lookup_mnt(path->mnt, path->dentry); in __follow_mount_rcu()
1424 path->dentry = mounted->mnt.mnt_root; in __follow_mount_rcu()
1426 *seqp = read_seqcount_begin(&path->dentry->d_seq); in __follow_mount_rcu()
1432 *inode = path->dentry->d_inode; in __follow_mount_rcu()
1435 !(path->dentry->d_flags & DCACHE_NEED_AUTOMOUNT); in __follow_mount_rcu()
1445 if (nd->path.dentry != nd->path.mnt->mnt_root) { in follow_dotdot_rcu()
1446 struct dentry *old = nd->path.dentry; in follow_dotdot_rcu()
1447 struct dentry *parent = old->d_parent; in follow_dotdot_rcu()
1454 nd->path.dentry = parent; in follow_dotdot_rcu()
1462 struct dentry *mountpoint = mnt->mnt_mountpoint; in follow_dotdot_rcu()
1470 nd->path.dentry = mountpoint; in follow_dotdot_rcu()
1476 while (unlikely(d_mountpoint(nd->path.dentry))) { in follow_dotdot_rcu()
1478 mounted = __lookup_mnt(nd->path.mnt, nd->path.dentry); in follow_dotdot_rcu()
1484 nd->path.dentry = mounted->mnt.mnt_root; in follow_dotdot_rcu()
1485 inode = nd->path.dentry->d_inode; in follow_dotdot_rcu()
1486 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); in follow_dotdot_rcu()
1502 while (managed = READ_ONCE(path->dentry->d_flags), in follow_down()
1515 BUG_ON(!path->dentry->d_op); in follow_down()
1516 BUG_ON(!path->dentry->d_op->d_manage); in follow_down()
1517 ret = path->dentry->d_op->d_manage(path, false); in follow_down()
1527 dput(path->dentry); in follow_down()
1530 path->dentry = dget(mounted->mnt_root); in follow_down()
1546 while (d_mountpoint(path->dentry)) { in follow_mount()
1550 dput(path->dentry); in follow_mount()
1553 path->dentry = dget(mounted->mnt_root); in follow_mount()
1559 struct dentry *old = path->dentry; in path_parent_directory()
1561 path->dentry = dget_parent(path->dentry); in path_parent_directory()
1573 if (nd->path.dentry != nd->path.mnt->mnt_root) { in follow_dotdot()
1583 nd->inode = nd->path.dentry->d_inode; in follow_dotdot()
1591 static struct dentry *lookup_dcache(const struct qstr *name, in lookup_dcache()
1592 struct dentry *dir, in lookup_dcache()
1595 struct dentry *dentry = d_lookup(dir, name); in lookup_dcache() local
1596 if (dentry) { in lookup_dcache()
1597 int error = d_revalidate(dentry, flags); in lookup_dcache()
1600 d_invalidate(dentry); in lookup_dcache()
1601 dput(dentry); in lookup_dcache()
1605 return dentry; in lookup_dcache()
1615 static struct dentry *__lookup_hash(const struct qstr *name, in __lookup_hash()
1616 struct dentry *base, unsigned int flags) in __lookup_hash()
1618 struct dentry *dentry = lookup_dcache(name, base, flags); in __lookup_hash() local
1619 struct dentry *old; in __lookup_hash()
1622 if (dentry) in __lookup_hash()
1623 return dentry; in __lookup_hash()
1629 dentry = d_alloc(base, name); in __lookup_hash()
1630 if (unlikely(!dentry)) in __lookup_hash()
1633 old = dir->i_op->lookup(dir, dentry, flags); in __lookup_hash()
1635 dput(dentry); in __lookup_hash()
1636 dentry = old; in __lookup_hash()
1638 return dentry; in __lookup_hash()
1646 struct dentry *dentry, *parent = nd->path.dentry; in lookup_fast() local
1658 dentry = __d_lookup_rcu(parent, &nd->last, &seq); in lookup_fast()
1659 if (unlikely(!dentry)) { in lookup_fast()
1669 *inode = d_backing_inode(dentry); in lookup_fast()
1670 negative = d_is_negative(dentry); in lookup_fast()
1671 if (unlikely(read_seqcount_retry(&dentry->d_seq, seq))) in lookup_fast()
1685 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1694 path->dentry = dentry; in lookup_fast()
1698 if (unlazy_child(nd, dentry, seq)) in lookup_fast()
1702 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1704 dentry = __d_lookup(parent, &nd->last); in lookup_fast()
1705 if (unlikely(!dentry)) in lookup_fast()
1707 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1711 d_invalidate(dentry); in lookup_fast()
1712 dput(dentry); in lookup_fast()
1715 if (unlikely(d_is_negative(dentry))) { in lookup_fast()
1716 dput(dentry); in lookup_fast()
1721 path->dentry = dentry; in lookup_fast()
1724 *inode = d_backing_inode(path->dentry); in lookup_fast()
1729 static struct dentry *__lookup_slow(const struct qstr *name, in __lookup_slow()
1730 struct dentry *dir, in __lookup_slow()
1733 struct dentry *dentry, *old; in __lookup_slow() local
1741 dentry = d_alloc_parallel(dir, name, &wq); in __lookup_slow()
1742 if (IS_ERR(dentry)) in __lookup_slow()
1743 return dentry; in __lookup_slow()
1744 if (unlikely(!d_in_lookup(dentry))) { in __lookup_slow()
1746 int error = d_revalidate(dentry, flags); in __lookup_slow()
1749 d_invalidate(dentry); in __lookup_slow()
1750 dput(dentry); in __lookup_slow()
1753 dput(dentry); in __lookup_slow()
1754 dentry = ERR_PTR(error); in __lookup_slow()
1758 old = inode->i_op->lookup(inode, dentry, flags); in __lookup_slow()
1759 d_lookup_done(dentry); in __lookup_slow()
1761 dput(dentry); in __lookup_slow()
1762 dentry = old; in __lookup_slow()
1765 return dentry; in __lookup_slow()
1768 static struct dentry *lookup_slow(const struct qstr *name, in lookup_slow()
1769 struct dentry *dir, in lookup_slow()
1773 struct dentry *res; in lookup_slow()
1826 nd->path.dentry = NULL; in pick_link()
1858 if (likely(!d_is_symlink(path->dentry)) || in step_into()
1868 if (read_seqcount_retry(&path->dentry->d_seq, seq)) in step_into()
1895 path.dentry = lookup_slow(&nd->last, nd->path.dentry, in walk_component()
1897 if (IS_ERR(path.dentry)) in walk_component()
1898 return PTR_ERR(path.dentry); in walk_component()
1905 if (unlikely(d_is_negative(path.dentry))) { in walk_component()
1911 inode = d_backing_inode(path.dentry); in walk_component()
2173 hash_len = hash_name(nd->path.dentry, name); in link_path_walk()
2187 struct dentry *parent = nd->path.dentry; in link_path_walk()
2246 if (unlikely(!d_can_lookup(nd->path.dentry))) { in link_path_walk()
2270 struct dentry *root = nd->root.dentry; in path_init()
2277 nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
2288 nd->path.dentry = NULL; in path_init()
2304 nd->inode = nd->path.dentry->d_inode; in path_init()
2305 nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
2309 nd->inode = nd->path.dentry->d_inode; in path_init()
2315 struct dentry *dentry; in path_init() local
2320 dentry = f.file->f_path.dentry; in path_init()
2322 if (*s && unlikely(!d_can_lookup(dentry))) { in path_init()
2329 nd->inode = nd->path.dentry->d_inode; in path_init()
2330 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
2333 nd->inode = nd->path.dentry->d_inode; in path_init()
2377 dget(path.dentry); in handle_lookup_down()
2381 inode = d_backing_inode(path.dentry); in handle_lookup_down()
2410 if (!d_can_lookup(nd->path.dentry)) in path_lookupat()
2415 nd->path.dentry = NULL; in path_lookupat()
2440 audit_inode(name, path->dentry, 0); in filename_lookup()
2457 nd->path.dentry = NULL; in path_parentat()
2481 audit_inode(name, parent->dentry, AUDIT_INODE_PARENT); in filename_parentat()
2491 struct dentry *kern_path_locked(const char *name, struct path *path) in kern_path_locked()
2494 struct dentry *d; in kern_path_locked()
2507 inode_lock_nested(path->dentry->d_inode, I_MUTEX_PARENT); in kern_path_locked()
2508 d = __lookup_hash(&last, path->dentry, 0); in kern_path_locked()
2510 inode_unlock(path->dentry->d_inode); in kern_path_locked()
2532 int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, in vfs_path_lookup() argument
2536 struct path root = {.mnt = mnt, .dentry = dentry}; in vfs_path_lookup()
2544 struct dentry *base, int len, struct qstr *this) in lookup_one_len_common()
2589 struct dentry *try_lookup_one_len(const char *name, struct dentry *base, int len) in try_lookup_one_len()
2615 struct dentry *lookup_one_len2(const char *name, struct vfsmount *mnt, struct dentry *base, int len) in lookup_one_len2()
2617 struct dentry *dentry; in lookup_one_len2() local
2627 dentry = lookup_dcache(&this, base, 0); in lookup_one_len2()
2628 return dentry ? dentry : __lookup_slow(&this, base, 0); in lookup_one_len2()
2632 struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) in lookup_one_len()
2650 struct dentry *lookup_one_len_unlocked(const char *name, in lookup_one_len_unlocked()
2651 struct dentry *base, int len) in lookup_one_len_unlocked()
2655 struct dentry *ret; in lookup_one_len_unlocked()
2674 struct dentry *child, *parent; in path_pts()
2682 parent = path->dentry; in path_pts()
2689 path->dentry = child; in path_pts()
2731 struct dentry *dir = nd->path.dentry; in mountpoint_last()
2746 path.dentry = dget(nd->path.dentry); in mountpoint_last()
2748 path.dentry = d_lookup(dir, &nd->last); in mountpoint_last()
2749 if (!path.dentry) { in mountpoint_last()
2756 path.dentry = lookup_slow(&nd->last, dir, in mountpoint_last()
2758 if (IS_ERR(path.dentry)) in mountpoint_last()
2759 return PTR_ERR(path.dentry); in mountpoint_last()
2762 if (d_is_negative(path.dentry)) { in mountpoint_last()
2763 dput(path.dentry); in mountpoint_last()
2767 return step_into(nd, &path, 0, d_backing_inode(path.dentry), 0); in mountpoint_last()
2792 nd->path.dentry = NULL; in path_mountpoint()
2814 audit_inode(name, path->dentry, AUDIT_INODE_NOEVAL); in filename_mountpoint()
2881 static int may_delete(struct vfsmount *mnt, struct inode *dir, struct dentry *victim, bool isdir) in may_delete()
2930 static inline int may_create(struct vfsmount *mnt, struct inode *dir, struct dentry *child) in may_create()
2948 struct dentry *lock_rename(struct dentry *p1, struct dentry *p2) in lock_rename()
2950 struct dentry *p; in lock_rename()
2979 void unlock_rename(struct dentry *p1, struct dentry *p2) in unlock_rename()
2989 int vfs_create2(struct vfsmount *mnt, struct inode *dir, struct dentry *dentry, in vfs_create2() argument
2992 int error = may_create(mnt, dir, dentry); in vfs_create2()
3000 error = security_inode_create(dir, dentry, mode); in vfs_create2()
3003 error = dir->i_op->create(dir, dentry, mode, want_excl); in vfs_create2()
3005 fsnotify_create(dir, dentry); in vfs_create2()
3010 int vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, in vfs_create() argument
3013 return vfs_create2(NULL, dir, dentry, mode, want_excl); in vfs_create()
3017 int vfs_mkobj2(struct vfsmount *mnt, struct dentry *dentry, umode_t mode, in vfs_mkobj2() argument
3018 int (*f)(struct dentry *, umode_t, void *), in vfs_mkobj2() argument
3021 struct inode *dir = dentry->d_parent->d_inode; in vfs_mkobj2()
3022 int error = may_create(mnt, dir, dentry); in vfs_mkobj2()
3028 error = security_inode_create(dir, dentry, mode); in vfs_mkobj2()
3031 error = f(dentry, mode, arg); in vfs_mkobj2()
3033 fsnotify_create(dir, dentry); in vfs_mkobj2()
3039 int vfs_mkobj(struct dentry *dentry, umode_t mode, in vfs_mkobj() argument
3040 int (*f)(struct dentry *, umode_t, void *), in vfs_mkobj() argument
3043 return vfs_mkobj2(NULL, dentry, mode, f, arg); in vfs_mkobj()
3055 struct dentry *dentry = path->dentry; in may_open() local
3057 struct inode *inode = dentry->d_inode; in may_open()
3105 struct inode *inode = path->dentry->d_inode; in handle_truncate()
3116 error = do_truncate2(path->mnt, path->dentry, 0, in handle_truncate()
3131 static int may_o_create(const struct path *dir, struct dentry *dentry, umode_t mode) in may_o_create() argument
3134 int error = security_path_mknod(dir, dentry, mode, 0); in may_o_create()
3138 s_user_ns = dir->dentry->d_sb->s_user_ns; in may_o_create()
3143 error = inode_permission2(dir->mnt, dir->dentry->d_inode, MAY_WRITE | MAY_EXEC); in may_o_create()
3147 return security_inode_create(dir->dentry->d_inode, dentry, mode); in may_o_create()
3163 static int atomic_open(struct nameidata *nd, struct dentry *dentry, in atomic_open() argument
3168 struct dentry *const DENTRY_NOT_SET = (void *) -1UL; in atomic_open()
3169 struct inode *dir = nd->path.dentry->d_inode; in atomic_open()
3178 file->f_path.dentry = DENTRY_NOT_SET; in atomic_open()
3180 error = dir->i_op->atomic_open(dir, dentry, file, in atomic_open()
3182 d_lookup_done(dentry); in atomic_open()
3192 fsnotify_create(dir, dentry); in atomic_open()
3198 } else if (WARN_ON(file->f_path.dentry == DENTRY_NOT_SET)) { in atomic_open()
3201 if (file->f_path.dentry) { in atomic_open()
3202 dput(dentry); in atomic_open()
3203 dentry = file->f_path.dentry; in atomic_open()
3206 fsnotify_create(dir, dentry); in atomic_open()
3207 if (unlikely(d_is_negative(dentry))) { in atomic_open()
3210 path->dentry = dentry; in atomic_open()
3216 dput(dentry); in atomic_open()
3240 struct dentry *dir = nd->path.dentry; in lookup_open()
3243 struct dentry *dentry; in lookup_open() local
3252 dentry = d_lookup(dir, &nd->last); in lookup_open()
3254 if (!dentry) { in lookup_open()
3255 dentry = d_alloc_parallel(dir, &nd->last, &wq); in lookup_open()
3256 if (IS_ERR(dentry)) in lookup_open()
3257 return PTR_ERR(dentry); in lookup_open()
3259 if (d_in_lookup(dentry)) in lookup_open()
3262 error = d_revalidate(dentry, nd->flags); in lookup_open()
3267 d_invalidate(dentry); in lookup_open()
3268 dput(dentry); in lookup_open()
3269 dentry = NULL; in lookup_open()
3271 if (dentry->d_inode) { in lookup_open()
3295 create_error = may_o_create(&nd->path, dentry, mode); in lookup_open()
3312 error = atomic_open(nd, dentry, path, file, op, open_flag, in lookup_open()
3320 if (d_in_lookup(dentry)) { in lookup_open()
3321 struct dentry *res = dir_inode->i_op->lookup(dir_inode, dentry, in lookup_open()
3323 d_lookup_done(dentry); in lookup_open()
3329 dput(dentry); in lookup_open()
3330 dentry = res; in lookup_open()
3335 if (!dentry->d_inode && (open_flag & O_CREAT)) { in lookup_open()
3337 audit_inode_child(dir_inode, dentry, AUDIT_TYPE_CHILD_CREATE); in lookup_open()
3342 error = dir_inode->i_op->create(dir_inode, dentry, mode, in lookup_open()
3346 fsnotify_create(dir_inode, dentry); in lookup_open()
3348 if (unlikely(create_error) && !dentry->d_inode) { in lookup_open()
3353 path->dentry = dentry; in lookup_open()
3358 dput(dentry); in lookup_open()
3368 struct dentry *dir = nd->path.dentry; in do_last()
3448 audit_inode(nd->name, file->f_path.dentry, 0); in do_last()
3475 if (unlikely(d_is_negative(path.dentry))) { in do_last()
3483 audit_inode(nd->name, path.dentry, 0); in do_last()
3491 inode = d_backing_inode(path.dentry); in do_last()
3501 audit_inode(nd->name, nd->path.dentry, 0); in do_last()
3504 if (d_is_dir(nd->path.dentry)) in do_last()
3507 d_backing_inode(nd->path.dentry)); in do_last()
3512 if ((nd->flags & LOOKUP_DIRECTORY) && !d_can_lookup(nd->path.dentry)) in do_last()
3514 if (!d_is_reg(nd->path.dentry)) in do_last()
3545 struct dentry *vfs_tmpfile(struct dentry *dentry, umode_t mode, int open_flag) in vfs_tmpfile() argument
3547 struct dentry *child = NULL; in vfs_tmpfile()
3548 struct inode *dir = dentry->d_inode; in vfs_tmpfile()
3561 child = d_alloc(dentry, &slash_name); in vfs_tmpfile()
3589 struct dentry *child; in do_tmpfile()
3597 child = vfs_tmpfile(path.dentry, op->mode, op->open_flag); in do_tmpfile()
3601 dput(path.dentry); in do_tmpfile()
3602 path.dentry = child; in do_tmpfile()
3622 audit_inode(nd->name, path.dentry, 0); in do_o_path()
3685 struct file *do_file_open_root(struct dentry *dentry, struct vfsmount *mnt, in do_file_open_root() argument
3694 nd.root.dentry = dentry; in do_file_open_root()
3696 if (d_is_symlink(dentry) && op->intent & LOOKUP_OPEN) in do_file_open_root()
3714 static struct dentry *filename_create(int dfd, struct filename *name, in filename_create()
3717 struct dentry *dentry = ERR_PTR(-EEXIST); in filename_create() local
3747 inode_lock_nested(path->dentry->d_inode, I_MUTEX_PARENT); in filename_create()
3748 dentry = __lookup_hash(&last, path->dentry, lookup_flags); in filename_create()
3749 if (IS_ERR(dentry)) in filename_create()
3753 if (d_is_positive(dentry)) in filename_create()
3771 return dentry; in filename_create()
3773 dput(dentry); in filename_create()
3774 dentry = ERR_PTR(error); in filename_create()
3776 inode_unlock(path->dentry->d_inode); in filename_create()
3782 return dentry; in filename_create()
3785 struct dentry *kern_path_create(int dfd, const char *pathname, in kern_path_create()
3793 void done_path_create(struct path *path, struct dentry *dentry) in done_path_create() argument
3795 dput(dentry); in done_path_create()
3796 inode_unlock(path->dentry->d_inode); in done_path_create()
3802 inline struct dentry *user_path_create(int dfd, const char __user *pathname, in user_path_create()
3809 int vfs_mknod2(struct vfsmount *mnt, struct inode *dir, struct dentry *dentry, umode_t mode, dev_t … in vfs_mknod2() argument
3811 int error = may_create(mnt, dir, dentry); in vfs_mknod2()
3826 error = security_inode_mknod(dir, dentry, mode, dev); in vfs_mknod2()
3830 error = dir->i_op->mknod(dir, dentry, mode, dev); in vfs_mknod2()
3832 fsnotify_create(dir, dentry); in vfs_mknod2()
3837 int vfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) in vfs_mknod() argument
3839 return vfs_mknod2(NULL, dir, dentry, mode, dev); in vfs_mknod()
3863 struct dentry *dentry; in do_mknodat() local
3872 dentry = user_path_create(dfd, filename, &path, lookup_flags); in do_mknodat()
3873 if (IS_ERR(dentry)) in do_mknodat()
3874 return PTR_ERR(dentry); in do_mknodat()
3876 if (!IS_POSIXACL(path.dentry->d_inode)) in do_mknodat()
3878 error = security_path_mknod(&path, dentry, mode, dev); in do_mknodat()
3883 error = vfs_create2(path.mnt, path.dentry->d_inode,dentry,mode,true); in do_mknodat()
3885 ima_post_path_mknod(dentry); in do_mknodat()
3888 error = vfs_mknod2(path.mnt, path.dentry->d_inode,dentry,mode, in do_mknodat()
3892 error = vfs_mknod(path.dentry->d_inode,dentry,mode,0); in do_mknodat()
3896 done_path_create(&path, dentry); in do_mknodat()
3915 int vfs_mkdir2(struct vfsmount *mnt, struct inode *dir, struct dentry *dentry, umode_t mode) in vfs_mkdir2() argument
3917 int error = may_create(mnt, dir, dentry); in vfs_mkdir2()
3927 error = security_inode_mkdir(dir, dentry, mode); in vfs_mkdir2()
3934 error = dir->i_op->mkdir(dir, dentry, mode); in vfs_mkdir2()
3936 fsnotify_mkdir(dir, dentry); in vfs_mkdir2()
3941 int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) in vfs_mkdir() argument
3943 return vfs_mkdir2(NULL, dir, dentry, mode); in vfs_mkdir()
3949 struct dentry *dentry; in do_mkdirat() local
3955 dentry = user_path_create(dfd, pathname, &path, lookup_flags); in do_mkdirat()
3956 if (IS_ERR(dentry)) in do_mkdirat()
3957 return PTR_ERR(dentry); in do_mkdirat()
3959 if (!IS_POSIXACL(path.dentry->d_inode)) in do_mkdirat()
3961 error = security_path_mkdir(&path, dentry, mode); in do_mkdirat()
3963 error = vfs_mkdir2(path.mnt, path.dentry->d_inode, dentry, mode); in do_mkdirat()
3964 done_path_create(&path, dentry); in do_mkdirat()
3982 int vfs_rmdir2(struct vfsmount *mnt, struct inode *dir, struct dentry *dentry) in vfs_rmdir2() argument
3984 int error = may_delete(mnt, dir, dentry, 1); in vfs_rmdir2()
3992 dget(dentry); in vfs_rmdir2()
3993 inode_lock(dentry->d_inode); in vfs_rmdir2()
3996 if (is_local_mountpoint(dentry)) in vfs_rmdir2()
3999 error = security_inode_rmdir(dir, dentry); in vfs_rmdir2()
4003 error = dir->i_op->rmdir(dir, dentry); in vfs_rmdir2()
4007 shrink_dcache_parent(dentry); in vfs_rmdir2()
4008 dentry->d_inode->i_flags |= S_DEAD; in vfs_rmdir2()
4009 dont_mount(dentry); in vfs_rmdir2()
4010 detach_mounts(dentry); in vfs_rmdir2()
4011 fsnotify_rmdir(dir, dentry); in vfs_rmdir2()
4014 inode_unlock(dentry->d_inode); in vfs_rmdir2()
4015 dput(dentry); in vfs_rmdir2()
4017 d_delete(dentry); in vfs_rmdir2()
4022 int vfs_rmdir(struct inode *dir, struct dentry *dentry) in vfs_rmdir() argument
4024 return vfs_rmdir2(NULL, dir, dentry); in vfs_rmdir()
4032 struct dentry *dentry; in do_rmdir() local
4059 inode_lock_nested(path.dentry->d_inode, I_MUTEX_PARENT); in do_rmdir()
4060 dentry = __lookup_hash(&last, path.dentry, lookup_flags); in do_rmdir()
4061 error = PTR_ERR(dentry); in do_rmdir()
4062 if (IS_ERR(dentry)) in do_rmdir()
4064 if (!dentry->d_inode) { in do_rmdir()
4068 error = security_path_rmdir(&path, dentry); in do_rmdir()
4071 error = vfs_rmdir2(path.mnt, path.dentry->d_inode, dentry); in do_rmdir()
4073 dput(dentry); in do_rmdir()
4075 inode_unlock(path.dentry->d_inode); in do_rmdir()
4110 int vfs_unlink2(struct vfsmount *mnt, struct inode *dir, struct dentry *dentry, struct inode **dele… in vfs_unlink2() argument
4112 struct inode *target = dentry->d_inode; in vfs_unlink2()
4113 int error = may_delete(mnt, dir, dentry, 0); in vfs_unlink2()
4122 if (is_local_mountpoint(dentry)) in vfs_unlink2()
4125 error = security_inode_unlink(dir, dentry); in vfs_unlink2()
4130 error = dir->i_op->unlink(dir, dentry); in vfs_unlink2()
4132 dont_mount(dentry); in vfs_unlink2()
4133 detach_mounts(dentry); in vfs_unlink2()
4134 fsnotify_unlink(dir, dentry); in vfs_unlink2()
4142 if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { in vfs_unlink2()
4144 d_delete(dentry); in vfs_unlink2()
4151 int vfs_unlink(struct inode *dir, struct dentry *dentry, struct inode **delegated_inode) in vfs_unlink() argument
4153 return vfs_unlink2(NULL, dir, dentry, delegated_inode); in vfs_unlink()
4166 struct dentry *dentry; in do_unlinkat() local
4186 inode_lock_nested(path.dentry->d_inode, I_MUTEX_PARENT); in do_unlinkat()
4187 dentry = __lookup_hash(&last, path.dentry, lookup_flags); in do_unlinkat()
4188 error = PTR_ERR(dentry); in do_unlinkat()
4189 if (!IS_ERR(dentry)) { in do_unlinkat()
4193 inode = dentry->d_inode; in do_unlinkat()
4194 if (d_is_negative(dentry)) in do_unlinkat()
4197 error = security_path_unlink(&path, dentry); in do_unlinkat()
4200 error = vfs_unlink2(path.mnt, path.dentry->d_inode, dentry, &delegated_inode); in do_unlinkat()
4202 dput(dentry); in do_unlinkat()
4204 inode_unlock(path.dentry->d_inode); in do_unlinkat()
4225 if (d_is_negative(dentry)) in do_unlinkat()
4227 else if (d_is_dir(dentry)) in do_unlinkat()
4250 int vfs_symlink2(struct vfsmount *mnt, struct inode *dir, struct dentry *dentry, const char *oldnam… in vfs_symlink2() argument
4252 int error = may_create(mnt, dir, dentry); in vfs_symlink2()
4260 error = security_inode_symlink(dir, dentry, oldname); in vfs_symlink2()
4264 error = dir->i_op->symlink(dir, dentry, oldname); in vfs_symlink2()
4266 fsnotify_create(dir, dentry); in vfs_symlink2()
4271 int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname) in vfs_symlink() argument
4273 return vfs_symlink2(NULL, dir, dentry, oldname); in vfs_symlink()
4282 struct dentry *dentry; in do_symlinkat() local
4290 dentry = user_path_create(newdfd, newname, &path, lookup_flags); in do_symlinkat()
4291 error = PTR_ERR(dentry); in do_symlinkat()
4292 if (IS_ERR(dentry)) in do_symlinkat()
4295 error = security_path_symlink(&path, dentry, from->name); in do_symlinkat()
4297 error = vfs_symlink2(path.mnt, path.dentry->d_inode, dentry, from->name); in do_symlinkat()
4298 done_path_create(&path, dentry); in do_symlinkat()
4338 int vfs_link2(struct vfsmount *mnt, struct dentry *old_dentry, struct inode *dir, struct dentry *ne… in vfs_link2()
4399 int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry, struct inode … in vfs_link()
4417 struct dentry *new_dentry; in do_linkat()
4455 error = security_path_link(old_path.dentry, &new_path, new_dentry); in do_linkat()
4458 …error = vfs_link2(old_path.mnt, old_path.dentry, new_path.dentry->d_inode, new_dentry, &delegated_… in do_linkat()
4541 struct inode *old_dir, struct dentry *old_dentry, in vfs_rename2()
4542 struct inode *new_dir, struct dentry *new_dentry, in vfs_rename2()
4666 int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, in vfs_rename()
4667 struct inode *new_dir, struct dentry *new_dentry, in vfs_rename()
4677 struct dentry *old_dentry, *new_dentry; in do_renameat2()
4678 struct dentry *trap; in do_renameat2()
4735 trap = lock_rename(new_path.dentry, old_path.dentry); in do_renameat2()
4737 old_dentry = __lookup_hash(&old_last, old_path.dentry, lookup_flags); in do_renameat2()
4745 new_dentry = __lookup_hash(&new_last, new_path.dentry, lookup_flags | target_flags); in do_renameat2()
4785 error = vfs_rename2(old_path.mnt, old_path.dentry->d_inode, old_dentry, in do_renameat2()
4786 new_path.dentry->d_inode, new_dentry, in do_renameat2()
4793 unlock_rename(new_path.dentry, old_path.dentry); in do_renameat2()
4834 int vfs_whiteout(struct inode *dir, struct dentry *dentry) in vfs_whiteout() argument
4836 int error = may_create(NULL, dir, dentry); in vfs_whiteout()
4843 return dir->i_op->mknod(dir, dentry, in vfs_whiteout()
4873 int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen) in vfs_readlink() argument
4875 struct inode *inode = d_inode(dentry); in vfs_readlink()
4882 return inode->i_op->readlink(dentry, buffer, buflen); in vfs_readlink()
4884 if (!d_is_symlink(dentry)) in vfs_readlink()
4894 link = inode->i_op->get_link(dentry, inode, &done); in vfs_readlink()
4915 const char *vfs_get_link(struct dentry *dentry, struct delayed_call *done) in vfs_get_link() argument
4918 struct inode *inode = d_inode(dentry); in vfs_get_link()
4920 if (d_is_symlink(dentry)) { in vfs_get_link()
4921 res = ERR_PTR(security_inode_readlink(dentry)); in vfs_get_link()
4923 res = inode->i_op->get_link(dentry, inode, done); in vfs_get_link()
4930 const char *page_get_link(struct dentry *dentry, struct inode *inode, in page_get_link() argument
4937 if (!dentry) { in page_get_link()
4965 int page_readlink(struct dentry *dentry, char __user *buffer, int buflen) in page_readlink() argument
4969 page_get_link(dentry, d_inode(dentry), in page_readlink()