Lines Matching refs:dentry

487 	dget(path->dentry);  in path_get()
499 dput(path->dentry); in path_put()
536 p->path.dentry = NULL; in set_nameidata()
572 static bool path_connected(struct vfsmount *mnt, struct dentry *dentry) in path_connected() argument
580 return is_subdir(dentry, mnt->mnt_root); in path_connected()
611 nd->path.dentry = NULL; in terminate_walk()
621 path->dentry = NULL; in __legitimize_path()
624 if (unlikely(!lockref_get_not_dead(&path->dentry->d_lockref))) { in __legitimize_path()
625 path->dentry = NULL; in __legitimize_path()
628 return !read_seqcount_retry(&path->dentry->d_seq, seq); in __legitimize_path()
696 struct dentry *parent = nd->path.dentry; in try_to_unlazy()
713 nd->path.dentry = NULL; in try_to_unlazy()
732 static bool try_to_unlazy_next(struct nameidata *nd, struct dentry *dentry, unsigned seq) in try_to_unlazy_next() argument
741 if (unlikely(!lockref_get_not_dead(&nd->path.dentry->d_lockref))) in try_to_unlazy_next()
751 if (unlikely(!lockref_get_not_dead(&dentry->d_lockref))) in try_to_unlazy_next()
753 if (unlikely(read_seqcount_retry(&dentry->d_seq, seq))) in try_to_unlazy_next()
767 nd->path.dentry = NULL; in try_to_unlazy_next()
773 dput(dentry); in try_to_unlazy_next()
777 static inline int d_revalidate(struct dentry *dentry, unsigned int flags) in d_revalidate() argument
779 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) in d_revalidate()
780 return dentry->d_op->d_revalidate(dentry, flags); in d_revalidate()
872 struct dentry *dentry = nd->path.dentry; in complete_walk() local
913 if (likely(!(dentry->d_flags & DCACHE_OP_WEAK_REVALIDATE))) { in complete_walk()
918 status = dentry->d_op->d_weak_revalidate(dentry, nd->flags); in complete_walk()
948 nd->root_seq = __read_seqcount_begin(&nd->root.dentry->d_seq); in set_root()
972 struct dentry *d; in nd_jump_root()
974 d = nd->path.dentry; in nd_jump_root()
983 nd->inode = nd->path.dentry->d_inode; in nd_jump_root()
1012 nd->inode = nd->path.dentry->d_inode; in nd_jump_link()
1069 audit_inode(nd->name, nd->stack[0].link.dentry, 0); in may_follow_link()
1123 struct inode *inode = link->dentry->d_inode; in may_linkat()
1200 struct dentry *mountpoint; in follow_up()
1211 dput(path->dentry); in follow_up()
1212 path->dentry = mountpoint; in follow_up()
1223 struct dentry *mountpoint = m->mnt_mountpoint; in choose_mountpoint_rcu()
1226 if (unlikely(root->dentry == mountpoint && in choose_mountpoint_rcu()
1231 path->dentry = mountpoint; in choose_mountpoint_rcu()
1271 struct dentry *dentry = path->dentry; in follow_automount() local
1286 dentry->d_inode) in follow_automount()
1292 return finish_automount(dentry->d_op->d_automount(path), path); in follow_automount()
1312 ret = path->dentry->d_op->d_manage(path, false); in __traverse_mounts()
1313 flags = smp_load_acquire(&path->dentry->d_flags); in __traverse_mounts()
1321 dput(path->dentry); in __traverse_mounts()
1325 path->dentry = dget(mounted->mnt_root); in __traverse_mounts()
1327 flags = path->dentry->d_flags; in __traverse_mounts()
1338 flags = smp_load_acquire(&path->dentry->d_flags); in __traverse_mounts()
1357 unsigned flags = smp_load_acquire(&path->dentry->d_flags); in traverse_mounts()
1375 dput(path->dentry); in follow_down_one()
1378 path->dentry = dget(mounted->mnt_root); in follow_down_one()
1409 struct dentry *dentry = path->dentry; in __follow_mount_rcu() local
1410 unsigned int flags = dentry->d_flags; in __follow_mount_rcu()
1424 int res = dentry->d_op->d_manage(path, true); in __follow_mount_rcu()
1427 flags = dentry->d_flags; in __follow_mount_rcu()
1431 struct mount *mounted = __lookup_mnt(path->mnt, dentry); in __follow_mount_rcu()
1434 dentry = path->dentry = mounted->mnt.mnt_root; in __follow_mount_rcu()
1436 *seqp = read_seqcount_begin(&dentry->d_seq); in __follow_mount_rcu()
1437 *inode = dentry->d_inode; in __follow_mount_rcu()
1444 flags = dentry->d_flags; in __follow_mount_rcu()
1456 static inline int handle_mounts(struct nameidata *nd, struct dentry *dentry, in handle_mounts() argument
1464 path->dentry = dentry; in handle_mounts()
1471 if (!try_to_unlazy_next(nd, dentry, seq)) in handle_mounts()
1475 path->dentry = dentry; in handle_mounts()
1485 dput(path->dentry); in handle_mounts()
1489 *inode = d_backing_inode(path->dentry); in handle_mounts()
1499 static struct dentry *lookup_dcache(const struct qstr *name, in lookup_dcache()
1500 struct dentry *dir, in lookup_dcache()
1503 struct dentry *dentry = d_lookup(dir, name); in lookup_dcache() local
1504 if (dentry) { in lookup_dcache()
1505 int error = d_revalidate(dentry, flags); in lookup_dcache()
1508 d_invalidate(dentry); in lookup_dcache()
1509 dput(dentry); in lookup_dcache()
1513 return dentry; in lookup_dcache()
1523 static struct dentry *__lookup_hash(const struct qstr *name, in __lookup_hash()
1524 struct dentry *base, unsigned int flags) in __lookup_hash()
1526 struct dentry *dentry = lookup_dcache(name, base, flags); in __lookup_hash() local
1527 struct dentry *old; in __lookup_hash()
1530 if (dentry) in __lookup_hash()
1531 return dentry; in __lookup_hash()
1537 dentry = d_alloc(base, name); in __lookup_hash()
1538 if (unlikely(!dentry)) in __lookup_hash()
1541 old = dir->i_op->lookup(dir, dentry, flags); in __lookup_hash()
1543 dput(dentry); in __lookup_hash()
1544 dentry = old; in __lookup_hash()
1546 return dentry; in __lookup_hash()
1549 static struct dentry *lookup_fast(struct nameidata *nd, in lookup_fast()
1553 struct dentry *dentry, *parent = nd->path.dentry; in lookup_fast() local
1563 dentry = __d_lookup_rcu(parent, &nd->last, &seq); in lookup_fast()
1564 if (unlikely(!dentry)) { in lookup_fast()
1574 *inode = d_backing_inode(dentry); in lookup_fast()
1575 if (unlikely(read_seqcount_retry(&dentry->d_seq, seq))) in lookup_fast()
1589 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1591 return dentry; in lookup_fast()
1592 if (!try_to_unlazy_next(nd, dentry, seq)) in lookup_fast()
1596 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1598 dentry = __d_lookup(parent, &nd->last); in lookup_fast()
1599 if (unlikely(!dentry)) in lookup_fast()
1601 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1605 d_invalidate(dentry); in lookup_fast()
1606 dput(dentry); in lookup_fast()
1609 return dentry; in lookup_fast()
1613 static struct dentry *__lookup_slow(const struct qstr *name, in __lookup_slow()
1614 struct dentry *dir, in __lookup_slow()
1617 struct dentry *dentry, *old; in __lookup_slow() local
1625 dentry = d_alloc_parallel(dir, name, &wq); in __lookup_slow()
1626 if (IS_ERR(dentry)) in __lookup_slow()
1627 return dentry; in __lookup_slow()
1628 if (unlikely(!d_in_lookup(dentry))) { in __lookup_slow()
1629 int error = d_revalidate(dentry, flags); in __lookup_slow()
1632 d_invalidate(dentry); in __lookup_slow()
1633 dput(dentry); in __lookup_slow()
1636 dput(dentry); in __lookup_slow()
1637 dentry = ERR_PTR(error); in __lookup_slow()
1640 old = inode->i_op->lookup(inode, dentry, flags); in __lookup_slow()
1641 d_lookup_done(dentry); in __lookup_slow()
1643 dput(dentry); in __lookup_slow()
1644 dentry = old; in __lookup_slow()
1647 return dentry; in __lookup_slow()
1650 static struct dentry *lookup_slow(const struct qstr *name, in lookup_slow()
1651 struct dentry *dir, in lookup_slow()
1655 struct dentry *res; in lookup_slow()
1736 error = security_inode_follow_link(link->dentry, inode, in pick_link()
1743 const char * (*get)(struct dentry *, struct inode *, in pick_link()
1749 res = get(link->dentry, inode, &last->done); in pick_link()
1751 res = get(link->dentry, inode, &last->done); in pick_link()
1779 struct dentry *dentry, struct inode *inode, unsigned seq) in step_into() argument
1782 int err = handle_mounts(nd, dentry, &path, &inode, &seq); in step_into()
1786 if (likely(!d_is_symlink(path.dentry)) || in step_into()
1791 dput(nd->path.dentry); in step_into()
1802 if (read_seqcount_retry(&path.dentry->d_seq, seq)) in step_into()
1811 static struct dentry *follow_dotdot_rcu(struct nameidata *nd, in follow_dotdot_rcu()
1815 struct dentry *parent, *old; in follow_dotdot_rcu()
1819 if (unlikely(nd->path.dentry == nd->path.mnt->mnt_root)) { in follow_dotdot_rcu()
1828 nd->inode = path.dentry->d_inode; in follow_dotdot_rcu()
1834 old = nd->path.dentry; in follow_dotdot_rcu()
1851 static struct dentry *follow_dotdot(struct nameidata *nd, in follow_dotdot()
1855 struct dentry *parent; in follow_dotdot()
1859 if (unlikely(nd->path.dentry == nd->path.mnt->mnt_root)) { in follow_dotdot()
1867 nd->inode = path.dentry->d_inode; in follow_dotdot()
1872 parent = dget_parent(nd->path.dentry); in follow_dotdot()
1884 dget(nd->path.dentry); in follow_dotdot()
1892 struct dentry *parent; in handle_dots()
1909 nd->path.dentry, nd->inode, nd->seq); in handle_dots()
1935 struct dentry *dentry; in walk_component() local
1948 dentry = lookup_fast(nd, &inode, &seq); in walk_component()
1949 if (IS_ERR(dentry)) in walk_component()
1950 return ERR_CAST(dentry); in walk_component()
1951 if (unlikely(!dentry)) { in walk_component()
1952 dentry = lookup_slow(&nd->last, nd->path.dentry, nd->flags); in walk_component()
1953 if (IS_ERR(dentry)) in walk_component()
1954 return ERR_CAST(dentry); in walk_component()
1958 return step_into(nd, flags, dentry, inode, seq); in walk_component()
2221 hash_len = hash_name(nd->path.dentry, name); in link_path_walk()
2235 struct dentry *parent = nd->path.dentry; in link_path_walk()
2285 if (unlikely(!d_can_lookup(nd->path.dentry))) { in link_path_walk()
2318 struct dentry *root = nd->root.dentry; in path_init()
2325 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
2352 nd->inode = nd->path.dentry->d_inode; in path_init()
2353 nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
2357 nd->inode = nd->path.dentry->d_inode; in path_init()
2362 struct dentry *dentry; in path_init() local
2367 dentry = f.file->f_path.dentry; in path_init()
2369 if (*s && unlikely(!d_can_lookup(dentry))) { in path_init()
2376 nd->inode = nd->path.dentry->d_inode; in path_init()
2377 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
2380 nd->inode = nd->path.dentry->d_inode; in path_init()
2409 dget(nd->path.dentry); in handle_lookup_down()
2411 nd->path.dentry, nd->inode, nd->seq)); in handle_lookup_down()
2437 if (!d_can_lookup(nd->path.dentry)) in path_lookupat()
2442 nd->path.dentry = NULL; in path_lookupat()
2467 audit_inode(name, path->dentry, in filename_lookup()
2485 nd->path.dentry = NULL; in path_parentat()
2509 audit_inode(name, parent->dentry, AUDIT_INODE_PARENT); in filename_parentat()
2519 struct dentry *kern_path_locked(const char *name, struct path *path) in kern_path_locked()
2522 struct dentry *d; in kern_path_locked()
2535 inode_lock_nested(path->dentry->d_inode, I_MUTEX_PARENT); in kern_path_locked()
2536 d = __lookup_hash(&last, path->dentry, 0); in kern_path_locked()
2538 inode_unlock(path->dentry->d_inode); in kern_path_locked()
2560 int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, in vfs_path_lookup() argument
2564 struct path root = {.mnt = mnt, .dentry = dentry}; in vfs_path_lookup()
2571 static int lookup_one_len_common(const char *name, struct dentry *base, in lookup_one_len_common()
2617 struct dentry *try_lookup_one_len(const char *name, struct dentry *base, int len) in try_lookup_one_len()
2643 struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) in lookup_one_len()
2645 struct dentry *dentry; in lookup_one_len() local
2655 dentry = lookup_dcache(&this, base, 0); in lookup_one_len()
2656 return dentry ? dentry : __lookup_slow(&this, base, 0); in lookup_one_len()
2672 struct dentry *lookup_one_len_unlocked(const char *name, in lookup_one_len_unlocked()
2673 struct dentry *base, int len) in lookup_one_len_unlocked()
2677 struct dentry *ret; in lookup_one_len_unlocked()
2698 struct dentry *lookup_positive_unlocked(const char *name, in lookup_positive_unlocked()
2699 struct dentry *base, int len) in lookup_positive_unlocked()
2701 struct dentry *ret = lookup_one_len_unlocked(name, base, len); in lookup_positive_unlocked()
2716 struct dentry *parent = dget_parent(path->dentry); in path_pts()
2717 struct dentry *child; in path_pts()
2724 dput(path->dentry); in path_pts()
2725 path->dentry = parent; in path_pts()
2730 path->dentry = child; in path_pts()
2777 static int may_delete(struct inode *dir, struct dentry *victim, bool isdir) in may_delete()
2826 static inline int may_create(struct inode *dir, struct dentry *child) in may_create()
2844 struct dentry *lock_rename(struct dentry *p1, struct dentry *p2) in lock_rename()
2846 struct dentry *p; in lock_rename()
2875 void unlock_rename(struct dentry *p1, struct dentry *p2) in unlock_rename()
2885 int vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, in vfs_create() argument
2888 int error = may_create(dir, dentry); in vfs_create()
2896 error = security_inode_create(dir, dentry, mode); in vfs_create()
2899 error = dir->i_op->create(dir, dentry, mode, want_excl); in vfs_create()
2901 fsnotify_create(dir, dentry); in vfs_create()
2906 int vfs_mkobj(struct dentry *dentry, umode_t mode, in vfs_mkobj() argument
2907 int (*f)(struct dentry *, umode_t, void *), in vfs_mkobj() argument
2910 struct inode *dir = dentry->d_parent->d_inode; in vfs_mkobj()
2911 int error = may_create(dir, dentry); in vfs_mkobj()
2917 error = security_inode_create(dir, dentry, mode); in vfs_mkobj()
2920 error = f(dentry, mode, arg); in vfs_mkobj()
2922 fsnotify_create(dir, dentry); in vfs_mkobj()
2935 struct dentry *dentry = path->dentry; in may_open() local
2936 struct inode *inode = dentry->d_inode; in may_open()
2992 struct inode *inode = path->dentry->d_inode; in handle_truncate()
3003 error = do_truncate(path->dentry, 0, in handle_truncate()
3018 static int may_o_create(const struct path *dir, struct dentry *dentry, umode_t mode) in may_o_create() argument
3021 int error = security_path_mknod(dir, dentry, mode, 0); in may_o_create()
3025 s_user_ns = dir->dentry->d_sb->s_user_ns; in may_o_create()
3030 error = inode_permission(dir->dentry->d_inode, MAY_WRITE | MAY_EXEC); in may_o_create()
3034 return security_inode_create(dir->dentry->d_inode, dentry, mode); in may_o_create()
3050 static struct dentry *atomic_open(struct nameidata *nd, struct dentry *dentry, in atomic_open() argument
3054 struct dentry *const DENTRY_NOT_SET = (void *) -1UL; in atomic_open()
3055 struct inode *dir = nd->path.dentry->d_inode; in atomic_open()
3061 file->f_path.dentry = DENTRY_NOT_SET; in atomic_open()
3063 error = dir->i_op->atomic_open(dir, dentry, file, in atomic_open()
3065 d_lookup_done(dentry); in atomic_open()
3068 if (unlikely(dentry != file->f_path.dentry)) { in atomic_open()
3069 dput(dentry); in atomic_open()
3070 dentry = dget(file->f_path.dentry); in atomic_open()
3072 } else if (WARN_ON(file->f_path.dentry == DENTRY_NOT_SET)) { in atomic_open()
3075 if (file->f_path.dentry) { in atomic_open()
3076 dput(dentry); in atomic_open()
3077 dentry = file->f_path.dentry; in atomic_open()
3079 if (unlikely(d_is_negative(dentry))) in atomic_open()
3084 dput(dentry); in atomic_open()
3085 dentry = ERR_PTR(error); in atomic_open()
3087 return dentry; in atomic_open()
3105 static struct dentry *lookup_open(struct nameidata *nd, struct file *file, in lookup_open()
3109 struct dentry *dir = nd->path.dentry; in lookup_open()
3112 struct dentry *dentry; in lookup_open() local
3121 dentry = d_lookup(dir, &nd->last); in lookup_open()
3123 if (!dentry) { in lookup_open()
3124 dentry = d_alloc_parallel(dir, &nd->last, &wq); in lookup_open()
3125 if (IS_ERR(dentry)) in lookup_open()
3126 return dentry; in lookup_open()
3128 if (d_in_lookup(dentry)) in lookup_open()
3131 error = d_revalidate(dentry, nd->flags); in lookup_open()
3136 d_invalidate(dentry); in lookup_open()
3137 dput(dentry); in lookup_open()
3138 dentry = NULL; in lookup_open()
3140 if (dentry->d_inode) { in lookup_open()
3142 return dentry; in lookup_open()
3162 create_error = may_o_create(&nd->path, dentry, mode); in lookup_open()
3169 dentry = atomic_open(nd, dentry, file, open_flag, mode); in lookup_open()
3170 if (unlikely(create_error) && dentry == ERR_PTR(-ENOENT)) in lookup_open()
3171 dentry = ERR_PTR(create_error); in lookup_open()
3172 return dentry; in lookup_open()
3175 if (d_in_lookup(dentry)) { in lookup_open()
3176 struct dentry *res = dir_inode->i_op->lookup(dir_inode, dentry, in lookup_open()
3178 d_lookup_done(dentry); in lookup_open()
3184 dput(dentry); in lookup_open()
3185 dentry = res; in lookup_open()
3190 if (!dentry->d_inode && (open_flag & O_CREAT)) { in lookup_open()
3192 audit_inode_child(dir_inode, dentry, AUDIT_TYPE_CHILD_CREATE); in lookup_open()
3197 error = dir_inode->i_op->create(dir_inode, dentry, mode, in lookup_open()
3202 if (unlikely(create_error) && !dentry->d_inode) { in lookup_open()
3206 return dentry; in lookup_open()
3209 dput(dentry); in lookup_open()
3216 struct dentry *dir = nd->path.dentry; in open_last_lookups()
3221 struct dentry *dentry; in open_last_lookups() local
3236 dentry = lookup_fast(nd, &inode, &seq); in open_last_lookups()
3237 if (IS_ERR(dentry)) in open_last_lookups()
3238 return ERR_CAST(dentry); in open_last_lookups()
3239 if (likely(dentry)) in open_last_lookups()
3267 dentry = lookup_open(nd, file, op, got_write); in open_last_lookups()
3268 if (!IS_ERR(dentry) && (file->f_mode & FMODE_CREATED)) in open_last_lookups()
3269 fsnotify_create(dir->d_inode, dentry); in open_last_lookups()
3278 if (IS_ERR(dentry)) in open_last_lookups()
3279 return ERR_CAST(dentry); in open_last_lookups()
3282 dput(nd->path.dentry); in open_last_lookups()
3283 nd->path.dentry = dentry; in open_last_lookups()
3290 res = step_into(nd, WALK_TRAILING, dentry, inode, seq); in open_last_lookups()
3313 audit_inode(nd->name, nd->path.dentry, 0); in do_open()
3317 if (d_is_dir(nd->path.dentry)) in do_open()
3320 d_backing_inode(nd->path.dentry)); in do_open()
3324 if ((nd->flags & LOOKUP_DIRECTORY) && !d_can_lookup(nd->path.dentry)) in do_open()
3333 } else if (d_is_reg(nd->path.dentry) && open_flag & O_TRUNC) { in do_open()
3355 struct dentry *vfs_tmpfile(struct dentry *dentry, umode_t mode, int open_flag) in vfs_tmpfile() argument
3357 struct dentry *child = NULL; in vfs_tmpfile()
3358 struct inode *dir = dentry->d_inode; in vfs_tmpfile()
3370 child = d_alloc(dentry, &slash_name); in vfs_tmpfile()
3400 struct dentry *child; in do_tmpfile()
3408 child = vfs_tmpfile(path.dentry, op->mode, op->open_flag); in do_tmpfile()
3412 dput(path.dentry); in do_tmpfile()
3413 path.dentry = child; in do_tmpfile()
3433 audit_inode(nd->name, path.dentry, 0); in do_o_path()
3496 struct file *do_file_open_root(struct dentry *dentry, struct vfsmount *mnt, in do_file_open_root() argument
3505 nd.root.dentry = dentry; in do_file_open_root()
3507 if (d_is_symlink(dentry) && op->intent & LOOKUP_OPEN) in do_file_open_root()
3525 static struct dentry *filename_create(int dfd, struct filename *name, in filename_create()
3528 struct dentry *dentry = ERR_PTR(-EEXIST); in filename_create() local
3558 inode_lock_nested(path->dentry->d_inode, I_MUTEX_PARENT); in filename_create()
3559 dentry = __lookup_hash(&last, path->dentry, lookup_flags); in filename_create()
3560 if (IS_ERR(dentry)) in filename_create()
3564 if (d_is_positive(dentry)) in filename_create()
3582 return dentry; in filename_create()
3584 dput(dentry); in filename_create()
3585 dentry = ERR_PTR(error); in filename_create()
3587 inode_unlock(path->dentry->d_inode); in filename_create()
3593 return dentry; in filename_create()
3596 struct dentry *kern_path_create(int dfd, const char *pathname, in kern_path_create()
3604 void done_path_create(struct path *path, struct dentry *dentry) in done_path_create() argument
3606 dput(dentry); in done_path_create()
3607 inode_unlock(path->dentry->d_inode); in done_path_create()
3613 inline struct dentry *user_path_create(int dfd, const char __user *pathname, in user_path_create()
3620 int vfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) in vfs_mknod() argument
3623 int error = may_create(dir, dentry); in vfs_mknod()
3639 error = security_inode_mknod(dir, dentry, mode, dev); in vfs_mknod()
3643 error = dir->i_op->mknod(dir, dentry, mode, dev); in vfs_mknod()
3645 fsnotify_create(dir, dentry); in vfs_mknod()
3670 struct dentry *dentry; in do_mknodat() local
3679 dentry = user_path_create(dfd, filename, &path, lookup_flags); in do_mknodat()
3680 if (IS_ERR(dentry)) in do_mknodat()
3681 return PTR_ERR(dentry); in do_mknodat()
3683 if (!IS_POSIXACL(path.dentry->d_inode)) in do_mknodat()
3685 error = security_path_mknod(&path, dentry, mode, dev); in do_mknodat()
3690 error = vfs_create(path.dentry->d_inode,dentry,mode,true); in do_mknodat()
3692 ima_post_path_mknod(dentry); in do_mknodat()
3695 error = vfs_mknod(path.dentry->d_inode,dentry,mode, in do_mknodat()
3699 error = vfs_mknod(path.dentry->d_inode,dentry,mode,0); in do_mknodat()
3703 done_path_create(&path, dentry); in do_mknodat()
3722 int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) in vfs_mkdir() argument
3724 int error = may_create(dir, dentry); in vfs_mkdir()
3734 error = security_inode_mkdir(dir, dentry, mode); in vfs_mkdir()
3741 error = dir->i_op->mkdir(dir, dentry, mode); in vfs_mkdir()
3743 fsnotify_mkdir(dir, dentry); in vfs_mkdir()
3750 struct dentry *dentry; in do_mkdirat() local
3756 dentry = user_path_create(dfd, pathname, &path, lookup_flags); in do_mkdirat()
3757 if (IS_ERR(dentry)) in do_mkdirat()
3758 return PTR_ERR(dentry); in do_mkdirat()
3760 if (!IS_POSIXACL(path.dentry->d_inode)) in do_mkdirat()
3762 error = security_path_mkdir(&path, dentry, mode); in do_mkdirat()
3764 error = vfs_mkdir(path.dentry->d_inode, dentry, mode); in do_mkdirat()
3765 done_path_create(&path, dentry); in do_mkdirat()
3783 int vfs_rmdir(struct inode *dir, struct dentry *dentry) in vfs_rmdir() argument
3785 int error = may_delete(dir, dentry, 1); in vfs_rmdir()
3793 dget(dentry); in vfs_rmdir()
3794 inode_lock(dentry->d_inode); in vfs_rmdir()
3797 if (is_local_mountpoint(dentry)) in vfs_rmdir()
3800 error = security_inode_rmdir(dir, dentry); in vfs_rmdir()
3804 error = dir->i_op->rmdir(dir, dentry); in vfs_rmdir()
3808 shrink_dcache_parent(dentry); in vfs_rmdir()
3809 dentry->d_inode->i_flags |= S_DEAD; in vfs_rmdir()
3810 dont_mount(dentry); in vfs_rmdir()
3811 detach_mounts(dentry); in vfs_rmdir()
3814 inode_unlock(dentry->d_inode); in vfs_rmdir()
3815 dput(dentry); in vfs_rmdir()
3817 d_delete_notify(dir, dentry); in vfs_rmdir()
3825 struct dentry *dentry; in do_rmdir() local
3852 inode_lock_nested(path.dentry->d_inode, I_MUTEX_PARENT); in do_rmdir()
3853 dentry = __lookup_hash(&last, path.dentry, lookup_flags); in do_rmdir()
3854 error = PTR_ERR(dentry); in do_rmdir()
3855 if (IS_ERR(dentry)) in do_rmdir()
3857 if (!dentry->d_inode) { in do_rmdir()
3861 error = security_path_rmdir(&path, dentry); in do_rmdir()
3864 error = vfs_rmdir(path.dentry->d_inode, dentry); in do_rmdir()
3866 dput(dentry); in do_rmdir()
3868 inode_unlock(path.dentry->d_inode); in do_rmdir()
3903 int vfs_unlink(struct inode *dir, struct dentry *dentry, struct inode **delegated_inode) in vfs_unlink() argument
3905 struct inode *target = dentry->d_inode; in vfs_unlink()
3906 int error = may_delete(dir, dentry, 0); in vfs_unlink()
3915 if (is_local_mountpoint(dentry)) in vfs_unlink()
3918 error = security_inode_unlink(dir, dentry); in vfs_unlink()
3923 error = dir->i_op->unlink(dir, dentry); in vfs_unlink()
3925 dont_mount(dentry); in vfs_unlink()
3926 detach_mounts(dentry); in vfs_unlink()
3934 if (!error && dentry->d_flags & DCACHE_NFSFS_RENAMED) { in vfs_unlink()
3935 fsnotify_unlink(dir, dentry); in vfs_unlink()
3938 d_delete_notify(dir, dentry); in vfs_unlink()
3954 struct dentry *dentry; in do_unlinkat() local
3974 inode_lock_nested(path.dentry->d_inode, I_MUTEX_PARENT); in do_unlinkat()
3975 dentry = __lookup_hash(&last, path.dentry, lookup_flags); in do_unlinkat()
3976 error = PTR_ERR(dentry); in do_unlinkat()
3977 if (!IS_ERR(dentry)) { in do_unlinkat()
3981 inode = dentry->d_inode; in do_unlinkat()
3982 if (d_is_negative(dentry)) in do_unlinkat()
3985 error = security_path_unlink(&path, dentry); in do_unlinkat()
3988 error = vfs_unlink(path.dentry->d_inode, dentry, &delegated_inode); in do_unlinkat()
3990 dput(dentry); in do_unlinkat()
3992 inode_unlock(path.dentry->d_inode); in do_unlinkat()
4013 if (d_is_negative(dentry)) in do_unlinkat()
4015 else if (d_is_dir(dentry)) in do_unlinkat()
4037 int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname) in vfs_symlink() argument
4039 int error = may_create(dir, dentry); in vfs_symlink()
4047 error = security_inode_symlink(dir, dentry, oldname); in vfs_symlink()
4051 error = dir->i_op->symlink(dir, dentry, oldname); in vfs_symlink()
4053 fsnotify_create(dir, dentry); in vfs_symlink()
4063 struct dentry *dentry; in do_symlinkat() local
4071 dentry = user_path_create(newdfd, newname, &path, lookup_flags); in do_symlinkat()
4072 error = PTR_ERR(dentry); in do_symlinkat()
4073 if (IS_ERR(dentry)) in do_symlinkat()
4076 error = security_path_symlink(&path, dentry, from->name); in do_symlinkat()
4078 error = vfs_symlink(path.dentry->d_inode, dentry, from->name); in do_symlinkat()
4079 done_path_create(&path, dentry); in do_symlinkat()
4119 int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry, struct inode … in vfs_link()
4192 struct dentry *new_dentry; in do_linkat()
4230 error = security_path_link(old_path.dentry, &new_path, new_dentry); in do_linkat()
4233 error = vfs_link(old_path.dentry, new_path.dentry->d_inode, new_dentry, &delegated_inode); in do_linkat()
4315 int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, in vfs_rename()
4316 struct inode *new_dir, struct dentry *new_dentry, in vfs_rename()
4443 struct dentry *old_dentry, *new_dentry; in do_renameat2()
4444 struct dentry *trap; in do_renameat2()
4496 trap = lock_rename(new_path.dentry, old_path.dentry); in do_renameat2()
4498 old_dentry = __lookup_hash(&old_last, old_path.dentry, lookup_flags); in do_renameat2()
4506 new_dentry = __lookup_hash(&new_last, new_path.dentry, lookup_flags | target_flags); in do_renameat2()
4546 error = vfs_rename(old_path.dentry->d_inode, old_dentry, in do_renameat2()
4547 new_path.dentry->d_inode, new_dentry, in do_renameat2()
4554 unlock_rename(new_path.dentry, old_path.dentry); in do_renameat2()
4626 int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen) in vfs_readlink() argument
4628 struct inode *inode = d_inode(dentry); in vfs_readlink()
4635 return inode->i_op->readlink(dentry, buffer, buflen); in vfs_readlink()
4637 if (!d_is_symlink(dentry)) in vfs_readlink()
4647 link = inode->i_op->get_link(dentry, inode, &done); in vfs_readlink()
4668 const char *vfs_get_link(struct dentry *dentry, struct delayed_call *done) in vfs_get_link() argument
4671 struct inode *inode = d_inode(dentry); in vfs_get_link()
4673 if (d_is_symlink(dentry)) { in vfs_get_link()
4674 res = ERR_PTR(security_inode_readlink(dentry)); in vfs_get_link()
4676 res = inode->i_op->get_link(dentry, inode, done); in vfs_get_link()
4683 const char *page_get_link(struct dentry *dentry, struct inode *inode, in page_get_link() argument
4690 if (!dentry) { in page_get_link()
4718 int page_readlink(struct dentry *dentry, char __user *buffer, int buflen) in page_readlink() argument
4722 page_get_link(dentry, d_inode(dentry), in page_readlink()