Lines Matching refs:dentry
484 dget(path->dentry); in path_get()
496 dput(path->dentry); in path_put()
567 static bool path_connected(struct vfsmount *mnt, struct dentry *dentry) in path_connected() argument
575 return is_subdir(dentry, mnt->mnt_root); in path_connected()
614 path->dentry = NULL; in __legitimize_path()
617 if (unlikely(!lockref_get_not_dead(&path->dentry->d_lockref))) { in __legitimize_path()
618 path->dentry = NULL; in __legitimize_path()
621 return !read_seqcount_retry(&path->dentry->d_seq, seq); in __legitimize_path()
684 struct dentry *parent = nd->path.dentry; in unlazy_walk()
701 nd->path.dentry = NULL; in unlazy_walk()
720 static int unlazy_child(struct nameidata *nd, struct dentry *dentry, unsigned seq) in unlazy_child() argument
729 if (unlikely(!lockref_get_not_dead(&nd->path.dentry->d_lockref))) in unlazy_child()
739 if (unlikely(!lockref_get_not_dead(&dentry->d_lockref))) in unlazy_child()
741 if (unlikely(read_seqcount_retry(&dentry->d_seq, seq))) in unlazy_child()
755 nd->path.dentry = NULL; in unlazy_child()
761 dput(dentry); in unlazy_child()
765 static inline int d_revalidate(struct dentry *dentry, unsigned int flags) in d_revalidate() argument
767 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) in d_revalidate()
768 return dentry->d_op->d_revalidate(dentry, flags); in d_revalidate()
785 struct dentry *dentry = nd->path.dentry; in complete_walk() local
823 if (likely(!(dentry->d_flags & DCACHE_OP_WEAK_REVALIDATE))) in complete_walk()
826 status = dentry->d_op->d_weak_revalidate(dentry, nd->flags); in complete_walk()
854 nd->root_seq = __read_seqcount_begin(&nd->root.dentry->d_seq); in set_root()
878 struct dentry *d; in nd_jump_root()
880 d = nd->path.dentry; in nd_jump_root()
889 nd->inode = nd->path.dentry->d_inode; in nd_jump_root()
918 nd->inode = nd->path.dentry->d_inode; in nd_jump_link()
975 audit_inode(nd->name, nd->stack[0].link.dentry, 0); in may_follow_link()
1029 struct inode *inode = link->dentry->d_inode; in may_linkat()
1106 struct dentry *mountpoint; in follow_up()
1117 dput(path->dentry); in follow_up()
1118 path->dentry = mountpoint; in follow_up()
1129 struct dentry *mountpoint = m->mnt_mountpoint; in choose_mountpoint_rcu()
1132 if (unlikely(root->dentry == mountpoint && in choose_mountpoint_rcu()
1137 path->dentry = mountpoint; in choose_mountpoint_rcu()
1177 struct dentry *dentry = path->dentry; in follow_automount() local
1192 dentry->d_inode) in follow_automount()
1198 return finish_automount(dentry->d_op->d_automount(path), path); in follow_automount()
1218 ret = path->dentry->d_op->d_manage(path, false); in __traverse_mounts()
1219 flags = smp_load_acquire(&path->dentry->d_flags); in __traverse_mounts()
1227 dput(path->dentry); in __traverse_mounts()
1231 path->dentry = dget(mounted->mnt_root); in __traverse_mounts()
1233 flags = path->dentry->d_flags; in __traverse_mounts()
1244 flags = smp_load_acquire(&path->dentry->d_flags); in __traverse_mounts()
1263 unsigned flags = smp_load_acquire(&path->dentry->d_flags); in traverse_mounts()
1281 dput(path->dentry); in follow_down_one()
1284 path->dentry = dget(mounted->mnt_root); in follow_down_one()
1315 struct dentry *dentry = path->dentry; in __follow_mount_rcu() local
1316 unsigned int flags = dentry->d_flags; in __follow_mount_rcu()
1330 int res = dentry->d_op->d_manage(path, true); in __follow_mount_rcu()
1333 flags = dentry->d_flags; in __follow_mount_rcu()
1337 struct mount *mounted = __lookup_mnt(path->mnt, dentry); in __follow_mount_rcu()
1340 dentry = path->dentry = mounted->mnt.mnt_root; in __follow_mount_rcu()
1342 *seqp = read_seqcount_begin(&dentry->d_seq); in __follow_mount_rcu()
1343 *inode = dentry->d_inode; in __follow_mount_rcu()
1350 flags = dentry->d_flags; in __follow_mount_rcu()
1360 static inline int handle_mounts(struct nameidata *nd, struct dentry *dentry, in handle_mounts() argument
1368 path->dentry = dentry; in handle_mounts()
1375 if (unlazy_child(nd, dentry, seq)) in handle_mounts()
1379 path->dentry = dentry; in handle_mounts()
1389 dput(path->dentry); in handle_mounts()
1393 *inode = d_backing_inode(path->dentry); in handle_mounts()
1403 static struct dentry *lookup_dcache(const struct qstr *name, in lookup_dcache()
1404 struct dentry *dir, in lookup_dcache()
1407 struct dentry *dentry = d_lookup(dir, name); in lookup_dcache() local
1408 if (dentry) { in lookup_dcache()
1409 int error = d_revalidate(dentry, flags); in lookup_dcache()
1412 d_invalidate(dentry); in lookup_dcache()
1413 dput(dentry); in lookup_dcache()
1417 return dentry; in lookup_dcache()
1427 static struct dentry *__lookup_hash(const struct qstr *name, in __lookup_hash()
1428 struct dentry *base, unsigned int flags) in __lookup_hash()
1430 struct dentry *dentry = lookup_dcache(name, base, flags); in __lookup_hash() local
1431 struct dentry *old; in __lookup_hash()
1434 if (dentry) in __lookup_hash()
1435 return dentry; in __lookup_hash()
1441 dentry = d_alloc(base, name); in __lookup_hash()
1442 if (unlikely(!dentry)) in __lookup_hash()
1445 old = dir->i_op->lookup(dir, dentry, flags); in __lookup_hash()
1447 dput(dentry); in __lookup_hash()
1448 dentry = old; in __lookup_hash()
1450 return dentry; in __lookup_hash()
1453 static struct dentry *lookup_fast(struct nameidata *nd, in lookup_fast()
1457 struct dentry *dentry, *parent = nd->path.dentry; in lookup_fast() local
1467 dentry = __d_lookup_rcu(parent, &nd->last, &seq); in lookup_fast()
1468 if (unlikely(!dentry)) { in lookup_fast()
1478 *inode = d_backing_inode(dentry); in lookup_fast()
1479 if (unlikely(read_seqcount_retry(&dentry->d_seq, seq))) in lookup_fast()
1493 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1495 return dentry; in lookup_fast()
1496 if (unlazy_child(nd, dentry, seq)) in lookup_fast()
1500 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1502 dentry = __d_lookup(parent, &nd->last); in lookup_fast()
1503 if (unlikely(!dentry)) in lookup_fast()
1505 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1509 d_invalidate(dentry); in lookup_fast()
1510 dput(dentry); in lookup_fast()
1513 return dentry; in lookup_fast()
1517 static struct dentry *__lookup_slow(const struct qstr *name, in __lookup_slow()
1518 struct dentry *dir, in __lookup_slow()
1521 struct dentry *dentry, *old; in __lookup_slow() local
1529 dentry = d_alloc_parallel(dir, name, &wq); in __lookup_slow()
1530 if (IS_ERR(dentry)) in __lookup_slow()
1531 return dentry; in __lookup_slow()
1532 if (unlikely(!d_in_lookup(dentry))) { in __lookup_slow()
1533 int error = d_revalidate(dentry, flags); in __lookup_slow()
1536 d_invalidate(dentry); in __lookup_slow()
1537 dput(dentry); in __lookup_slow()
1540 dput(dentry); in __lookup_slow()
1541 dentry = ERR_PTR(error); in __lookup_slow()
1544 old = inode->i_op->lookup(inode, dentry, flags); in __lookup_slow()
1545 d_lookup_done(dentry); in __lookup_slow()
1547 dput(dentry); in __lookup_slow()
1548 dentry = old; in __lookup_slow()
1551 return dentry; in __lookup_slow()
1554 static struct dentry *lookup_slow(const struct qstr *name, in lookup_slow()
1555 struct dentry *dir, in lookup_slow()
1559 struct dentry *res; in lookup_slow()
1642 error = security_inode_follow_link(link->dentry, inode, in pick_link()
1649 const char * (*get)(struct dentry *, struct inode *, in pick_link()
1657 res = get(link->dentry, inode, &last->done); in pick_link()
1660 res = get(link->dentry, inode, &last->done); in pick_link()
1688 struct dentry *dentry, struct inode *inode, unsigned seq) in step_into() argument
1691 int err = handle_mounts(nd, dentry, &path, &inode, &seq); in step_into()
1695 if (likely(!d_is_symlink(path.dentry)) || in step_into()
1700 dput(nd->path.dentry); in step_into()
1711 if (read_seqcount_retry(&path.dentry->d_seq, seq)) in step_into()
1720 static struct dentry *follow_dotdot_rcu(struct nameidata *nd, in follow_dotdot_rcu()
1724 struct dentry *parent, *old; in follow_dotdot_rcu()
1728 if (unlikely(nd->path.dentry == nd->path.mnt->mnt_root)) { in follow_dotdot_rcu()
1737 nd->inode = path.dentry->d_inode; in follow_dotdot_rcu()
1743 old = nd->path.dentry; in follow_dotdot_rcu()
1760 static struct dentry *follow_dotdot(struct nameidata *nd, in follow_dotdot()
1764 struct dentry *parent; in follow_dotdot()
1768 if (unlikely(nd->path.dentry == nd->path.mnt->mnt_root)) { in follow_dotdot()
1776 nd->inode = path.dentry->d_inode; in follow_dotdot()
1781 parent = dget_parent(nd->path.dentry); in follow_dotdot()
1793 dget(nd->path.dentry); in follow_dotdot()
1801 struct dentry *parent; in handle_dots()
1818 nd->path.dentry, nd->inode, nd->seq); in handle_dots()
1844 struct dentry *dentry; in walk_component() local
1857 dentry = lookup_fast(nd, &inode, &seq); in walk_component()
1858 if (IS_ERR(dentry)) in walk_component()
1859 return ERR_CAST(dentry); in walk_component()
1860 if (unlikely(!dentry)) { in walk_component()
1861 dentry = lookup_slow(&nd->last, nd->path.dentry, nd->flags); in walk_component()
1862 if (IS_ERR(dentry)) in walk_component()
1863 return ERR_CAST(dentry); in walk_component()
1867 return step_into(nd, flags, dentry, inode, seq); in walk_component()
2130 hash_len = hash_name(nd->path.dentry, name); in link_path_walk()
2144 struct dentry *parent = nd->path.dentry; in link_path_walk()
2194 if (unlikely(!d_can_lookup(nd->path.dentry))) { in link_path_walk()
2223 struct dentry *root = nd->root.dentry; in path_init()
2230 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
2240 nd->path.dentry = NULL; in path_init()
2259 nd->inode = nd->path.dentry->d_inode; in path_init()
2260 nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
2264 nd->inode = nd->path.dentry->d_inode; in path_init()
2269 struct dentry *dentry; in path_init() local
2274 dentry = f.file->f_path.dentry; in path_init()
2276 if (*s && unlikely(!d_can_lookup(dentry))) { in path_init()
2283 nd->inode = nd->path.dentry->d_inode; in path_init()
2284 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
2287 nd->inode = nd->path.dentry->d_inode; in path_init()
2316 dget(nd->path.dentry); in handle_lookup_down()
2318 nd->path.dentry, nd->inode, nd->seq)); in handle_lookup_down()
2340 if (!d_can_lookup(nd->path.dentry)) in path_lookupat()
2349 nd->path.dentry = NULL; in path_lookupat()
2374 audit_inode(name, path->dentry, in filename_lookup()
2392 nd->path.dentry = NULL; in path_parentat()
2416 audit_inode(name, parent->dentry, AUDIT_INODE_PARENT); in filename_parentat()
2426 struct dentry *kern_path_locked(const char *name, struct path *path) in kern_path_locked()
2429 struct dentry *d; in kern_path_locked()
2442 inode_lock_nested(path->dentry->d_inode, I_MUTEX_PARENT); in kern_path_locked()
2443 d = __lookup_hash(&last, path->dentry, 0); in kern_path_locked()
2445 inode_unlock(path->dentry->d_inode); in kern_path_locked()
2467 int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, in vfs_path_lookup() argument
2471 struct path root = {.mnt = mnt, .dentry = dentry}; in vfs_path_lookup()
2478 static int lookup_one_len_common(const char *name, struct dentry *base, in lookup_one_len_common()
2524 struct dentry *try_lookup_one_len(const char *name, struct dentry *base, int len) in try_lookup_one_len()
2550 struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) in lookup_one_len()
2552 struct dentry *dentry; in lookup_one_len() local
2562 dentry = lookup_dcache(&this, base, 0); in lookup_one_len()
2563 return dentry ? dentry : __lookup_slow(&this, base, 0); in lookup_one_len()
2579 struct dentry *lookup_one_len_unlocked(const char *name, in lookup_one_len_unlocked()
2580 struct dentry *base, int len) in lookup_one_len_unlocked()
2584 struct dentry *ret; in lookup_one_len_unlocked()
2605 struct dentry *lookup_positive_unlocked(const char *name, in lookup_positive_unlocked()
2606 struct dentry *base, int len) in lookup_positive_unlocked()
2608 struct dentry *ret = lookup_one_len_unlocked(name, base, len); in lookup_positive_unlocked()
2623 struct dentry *parent = dget_parent(path->dentry); in path_pts()
2624 struct dentry *child; in path_pts()
2631 dput(path->dentry); in path_pts()
2632 path->dentry = parent; in path_pts()
2637 path->dentry = child; in path_pts()
2684 static int may_delete(struct inode *dir, struct dentry *victim, bool isdir) in may_delete()
2733 static inline int may_create(struct inode *dir, struct dentry *child) in may_create()
2751 struct dentry *lock_rename(struct dentry *p1, struct dentry *p2) in lock_rename()
2753 struct dentry *p; in lock_rename()
2782 void unlock_rename(struct dentry *p1, struct dentry *p2) in unlock_rename()
2792 int vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, in vfs_create() argument
2795 int error = may_create(dir, dentry); in vfs_create()
2803 error = security_inode_create(dir, dentry, mode); in vfs_create()
2806 error = dir->i_op->create(dir, dentry, mode, want_excl); in vfs_create()
2808 fsnotify_create(dir, dentry); in vfs_create()
2813 int vfs_mkobj(struct dentry *dentry, umode_t mode, in vfs_mkobj() argument
2814 int (*f)(struct dentry *, umode_t, void *), in vfs_mkobj() argument
2817 struct inode *dir = dentry->d_parent->d_inode; in vfs_mkobj()
2818 int error = may_create(dir, dentry); in vfs_mkobj()
2824 error = security_inode_create(dir, dentry, mode); in vfs_mkobj()
2827 error = f(dentry, mode, arg); in vfs_mkobj()
2829 fsnotify_create(dir, dentry); in vfs_mkobj()
2842 struct dentry *dentry = path->dentry; in may_open() local
2843 struct inode *inode = dentry->d_inode; in may_open()
2899 struct inode *inode = path->dentry->d_inode; in handle_truncate()
2910 error = do_truncate(path->dentry, 0, in handle_truncate()
2925 static int may_o_create(const struct path *dir, struct dentry *dentry, umode_t mode) in may_o_create() argument
2928 int error = security_path_mknod(dir, dentry, mode, 0); in may_o_create()
2932 s_user_ns = dir->dentry->d_sb->s_user_ns; in may_o_create()
2937 error = inode_permission(dir->dentry->d_inode, MAY_WRITE | MAY_EXEC); in may_o_create()
2941 return security_inode_create(dir->dentry->d_inode, dentry, mode); in may_o_create()
2957 static struct dentry *atomic_open(struct nameidata *nd, struct dentry *dentry, in atomic_open() argument
2961 struct dentry *const DENTRY_NOT_SET = (void *) -1UL; in atomic_open()
2962 struct inode *dir = nd->path.dentry->d_inode; in atomic_open()
2968 file->f_path.dentry = DENTRY_NOT_SET; in atomic_open()
2970 error = dir->i_op->atomic_open(dir, dentry, file, in atomic_open()
2972 d_lookup_done(dentry); in atomic_open()
2975 if (unlikely(dentry != file->f_path.dentry)) { in atomic_open()
2976 dput(dentry); in atomic_open()
2977 dentry = dget(file->f_path.dentry); in atomic_open()
2979 } else if (WARN_ON(file->f_path.dentry == DENTRY_NOT_SET)) { in atomic_open()
2982 if (file->f_path.dentry) { in atomic_open()
2983 dput(dentry); in atomic_open()
2984 dentry = file->f_path.dentry; in atomic_open()
2986 if (unlikely(d_is_negative(dentry))) in atomic_open()
2991 dput(dentry); in atomic_open()
2992 dentry = ERR_PTR(error); in atomic_open()
2994 return dentry; in atomic_open()
3012 static struct dentry *lookup_open(struct nameidata *nd, struct file *file, in lookup_open()
3016 struct dentry *dir = nd->path.dentry; in lookup_open()
3019 struct dentry *dentry; in lookup_open() local
3028 dentry = d_lookup(dir, &nd->last); in lookup_open()
3030 if (!dentry) { in lookup_open()
3031 dentry = d_alloc_parallel(dir, &nd->last, &wq); in lookup_open()
3032 if (IS_ERR(dentry)) in lookup_open()
3033 return dentry; in lookup_open()
3035 if (d_in_lookup(dentry)) in lookup_open()
3038 error = d_revalidate(dentry, nd->flags); in lookup_open()
3043 d_invalidate(dentry); in lookup_open()
3044 dput(dentry); in lookup_open()
3045 dentry = NULL; in lookup_open()
3047 if (dentry->d_inode) { in lookup_open()
3049 return dentry; in lookup_open()
3069 create_error = may_o_create(&nd->path, dentry, mode); in lookup_open()
3076 dentry = atomic_open(nd, dentry, file, open_flag, mode); in lookup_open()
3077 if (unlikely(create_error) && dentry == ERR_PTR(-ENOENT)) in lookup_open()
3078 dentry = ERR_PTR(create_error); in lookup_open()
3079 return dentry; in lookup_open()
3082 if (d_in_lookup(dentry)) { in lookup_open()
3083 struct dentry *res = dir_inode->i_op->lookup(dir_inode, dentry, in lookup_open()
3085 d_lookup_done(dentry); in lookup_open()
3091 dput(dentry); in lookup_open()
3092 dentry = res; in lookup_open()
3097 if (!dentry->d_inode && (open_flag & O_CREAT)) { in lookup_open()
3099 audit_inode_child(dir_inode, dentry, AUDIT_TYPE_CHILD_CREATE); in lookup_open()
3104 error = dir_inode->i_op->create(dir_inode, dentry, mode, in lookup_open()
3109 if (unlikely(create_error) && !dentry->d_inode) { in lookup_open()
3113 return dentry; in lookup_open()
3116 dput(dentry); in lookup_open()
3123 struct dentry *dir = nd->path.dentry; in open_last_lookups()
3128 struct dentry *dentry; in open_last_lookups() local
3144 dentry = lookup_fast(nd, &inode, &seq); in open_last_lookups()
3145 if (IS_ERR(dentry)) in open_last_lookups()
3146 return ERR_CAST(dentry); in open_last_lookups()
3147 if (likely(dentry)) in open_last_lookups()
3178 dentry = lookup_open(nd, file, op, got_write); in open_last_lookups()
3179 if (!IS_ERR(dentry) && (file->f_mode & FMODE_CREATED)) in open_last_lookups()
3180 fsnotify_create(dir->d_inode, dentry); in open_last_lookups()
3189 if (IS_ERR(dentry)) in open_last_lookups()
3190 return ERR_CAST(dentry); in open_last_lookups()
3193 dput(nd->path.dentry); in open_last_lookups()
3194 nd->path.dentry = dentry; in open_last_lookups()
3201 res = step_into(nd, WALK_TRAILING, dentry, inode, seq); in open_last_lookups()
3224 audit_inode(nd->name, nd->path.dentry, 0); in do_open()
3228 if (d_is_dir(nd->path.dentry)) in do_open()
3231 d_backing_inode(nd->path.dentry)); in do_open()
3235 if ((nd->flags & LOOKUP_DIRECTORY) && !d_can_lookup(nd->path.dentry)) in do_open()
3244 } else if (d_is_reg(nd->path.dentry) && open_flag & O_TRUNC) { in do_open()
3266 struct dentry *vfs_tmpfile(struct dentry *dentry, umode_t mode, int open_flag) in vfs_tmpfile() argument
3268 struct dentry *child = NULL; in vfs_tmpfile()
3269 struct inode *dir = dentry->d_inode; in vfs_tmpfile()
3281 child = d_alloc(dentry, &slash_name); in vfs_tmpfile()
3309 struct dentry *child; in do_tmpfile()
3317 child = vfs_tmpfile(path.dentry, op->mode, op->open_flag); in do_tmpfile()
3321 dput(path.dentry); in do_tmpfile()
3322 path.dentry = child; in do_tmpfile()
3342 audit_inode(nd->name, path.dentry, 0); in do_o_path()
3405 struct file *do_file_open_root(struct dentry *dentry, struct vfsmount *mnt, in do_file_open_root() argument
3414 nd.root.dentry = dentry; in do_file_open_root()
3416 if (d_is_symlink(dentry) && op->intent & LOOKUP_OPEN) in do_file_open_root()
3434 static struct dentry *filename_create(int dfd, struct filename *name, in filename_create()
3437 struct dentry *dentry = ERR_PTR(-EEXIST); in filename_create() local
3467 inode_lock_nested(path->dentry->d_inode, I_MUTEX_PARENT); in filename_create()
3468 dentry = __lookup_hash(&last, path->dentry, lookup_flags); in filename_create()
3469 if (IS_ERR(dentry)) in filename_create()
3473 if (d_is_positive(dentry)) in filename_create()
3491 return dentry; in filename_create()
3493 dput(dentry); in filename_create()
3494 dentry = ERR_PTR(error); in filename_create()
3496 inode_unlock(path->dentry->d_inode); in filename_create()
3502 return dentry; in filename_create()
3505 struct dentry *kern_path_create(int dfd, const char *pathname, in kern_path_create()
3513 void done_path_create(struct path *path, struct dentry *dentry) in done_path_create() argument
3515 dput(dentry); in done_path_create()
3516 inode_unlock(path->dentry->d_inode); in done_path_create()
3522 inline struct dentry *user_path_create(int dfd, const char __user *pathname, in user_path_create()
3529 int vfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) in vfs_mknod() argument
3532 int error = may_create(dir, dentry); in vfs_mknod()
3548 error = security_inode_mknod(dir, dentry, mode, dev); in vfs_mknod()
3552 error = dir->i_op->mknod(dir, dentry, mode, dev); in vfs_mknod()
3554 fsnotify_create(dir, dentry); in vfs_mknod()
3579 struct dentry *dentry; in do_mknodat() local
3588 dentry = user_path_create(dfd, filename, &path, lookup_flags); in do_mknodat()
3589 if (IS_ERR(dentry)) in do_mknodat()
3590 return PTR_ERR(dentry); in do_mknodat()
3592 if (!IS_POSIXACL(path.dentry->d_inode)) in do_mknodat()
3594 error = security_path_mknod(&path, dentry, mode, dev); in do_mknodat()
3599 error = vfs_create(path.dentry->d_inode,dentry,mode,true); in do_mknodat()
3601 ima_post_path_mknod(dentry); in do_mknodat()
3604 error = vfs_mknod(path.dentry->d_inode,dentry,mode, in do_mknodat()
3608 error = vfs_mknod(path.dentry->d_inode,dentry,mode,0); in do_mknodat()
3612 done_path_create(&path, dentry); in do_mknodat()
3631 int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) in vfs_mkdir() argument
3633 int error = may_create(dir, dentry); in vfs_mkdir()
3643 error = security_inode_mkdir(dir, dentry, mode); in vfs_mkdir()
3650 error = dir->i_op->mkdir(dir, dentry, mode); in vfs_mkdir()
3652 fsnotify_mkdir(dir, dentry); in vfs_mkdir()
3659 struct dentry *dentry; in do_mkdirat() local
3665 dentry = user_path_create(dfd, pathname, &path, lookup_flags); in do_mkdirat()
3666 if (IS_ERR(dentry)) in do_mkdirat()
3667 return PTR_ERR(dentry); in do_mkdirat()
3669 if (!IS_POSIXACL(path.dentry->d_inode)) in do_mkdirat()
3671 error = security_path_mkdir(&path, dentry, mode); in do_mkdirat()
3673 error = vfs_mkdir(path.dentry->d_inode, dentry, mode); in do_mkdirat()
3674 done_path_create(&path, dentry); in do_mkdirat()
3692 int vfs_rmdir(struct inode *dir, struct dentry *dentry) in vfs_rmdir() argument
3694 int error = may_delete(dir, dentry, 1); in vfs_rmdir()
3702 dget(dentry); in vfs_rmdir()
3703 inode_lock(dentry->d_inode); in vfs_rmdir()
3706 if (is_local_mountpoint(dentry)) in vfs_rmdir()
3709 error = security_inode_rmdir(dir, dentry); in vfs_rmdir()
3713 error = dir->i_op->rmdir(dir, dentry); in vfs_rmdir()
3717 shrink_dcache_parent(dentry); in vfs_rmdir()
3718 dentry->d_inode->i_flags |= S_DEAD; in vfs_rmdir()
3719 dont_mount(dentry); in vfs_rmdir()
3720 detach_mounts(dentry); in vfs_rmdir()
3721 fsnotify_rmdir(dir, dentry); in vfs_rmdir()
3724 inode_unlock(dentry->d_inode); in vfs_rmdir()
3725 dput(dentry); in vfs_rmdir()
3727 d_delete(dentry); in vfs_rmdir()
3735 struct dentry *dentry; in do_rmdir() local
3762 inode_lock_nested(path.dentry->d_inode, I_MUTEX_PARENT); in do_rmdir()
3763 dentry = __lookup_hash(&last, path.dentry, lookup_flags); in do_rmdir()
3764 error = PTR_ERR(dentry); in do_rmdir()
3765 if (IS_ERR(dentry)) in do_rmdir()
3767 if (!dentry->d_inode) { in do_rmdir()
3771 error = security_path_rmdir(&path, dentry); in do_rmdir()
3774 error = vfs_rmdir(path.dentry->d_inode, dentry); in do_rmdir()
3776 dput(dentry); in do_rmdir()
3778 inode_unlock(path.dentry->d_inode); in do_rmdir()
3813 int vfs_unlink(struct inode *dir, struct dentry *dentry, struct inode **delegated_inode) in vfs_unlink() argument
3815 struct inode *target = dentry->d_inode; in vfs_unlink()
3816 int error = may_delete(dir, dentry, 0); in vfs_unlink()
3825 if (is_local_mountpoint(dentry)) in vfs_unlink()
3828 error = security_inode_unlink(dir, dentry); in vfs_unlink()
3833 error = dir->i_op->unlink(dir, dentry); in vfs_unlink()
3835 dont_mount(dentry); in vfs_unlink()
3836 detach_mounts(dentry); in vfs_unlink()
3837 fsnotify_unlink(dir, dentry); in vfs_unlink()
3845 if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { in vfs_unlink()
3847 d_delete(dentry); in vfs_unlink()
3863 struct dentry *dentry; in do_unlinkat() local
3883 inode_lock_nested(path.dentry->d_inode, I_MUTEX_PARENT); in do_unlinkat()
3884 dentry = __lookup_hash(&last, path.dentry, lookup_flags); in do_unlinkat()
3885 error = PTR_ERR(dentry); in do_unlinkat()
3886 if (!IS_ERR(dentry)) { in do_unlinkat()
3890 inode = dentry->d_inode; in do_unlinkat()
3891 if (d_is_negative(dentry)) in do_unlinkat()
3894 error = security_path_unlink(&path, dentry); in do_unlinkat()
3897 error = vfs_unlink(path.dentry->d_inode, dentry, &delegated_inode); in do_unlinkat()
3899 dput(dentry); in do_unlinkat()
3901 inode_unlock(path.dentry->d_inode); in do_unlinkat()
3922 if (d_is_negative(dentry)) in do_unlinkat()
3924 else if (d_is_dir(dentry)) in do_unlinkat()
3946 int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname) in vfs_symlink() argument
3948 int error = may_create(dir, dentry); in vfs_symlink()
3956 error = security_inode_symlink(dir, dentry, oldname); in vfs_symlink()
3960 error = dir->i_op->symlink(dir, dentry, oldname); in vfs_symlink()
3962 fsnotify_create(dir, dentry); in vfs_symlink()
3972 struct dentry *dentry; in do_symlinkat() local
3980 dentry = user_path_create(newdfd, newname, &path, lookup_flags); in do_symlinkat()
3981 error = PTR_ERR(dentry); in do_symlinkat()
3982 if (IS_ERR(dentry)) in do_symlinkat()
3985 error = security_path_symlink(&path, dentry, from->name); in do_symlinkat()
3987 error = vfs_symlink(path.dentry->d_inode, dentry, from->name); in do_symlinkat()
3988 done_path_create(&path, dentry); in do_symlinkat()
4028 int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry, struct inode … in vfs_link()
4101 struct dentry *new_dentry; in do_linkat()
4139 error = security_path_link(old_path.dentry, &new_path, new_dentry); in do_linkat()
4142 error = vfs_link(old_path.dentry, new_path.dentry->d_inode, new_dentry, &delegated_inode); in do_linkat()
4224 int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, in vfs_rename()
4225 struct inode *new_dir, struct dentry *new_dentry, in vfs_rename()
4352 struct dentry *old_dentry, *new_dentry; in do_renameat2()
4353 struct dentry *trap; in do_renameat2()
4407 trap = lock_rename(new_path.dentry, old_path.dentry); in do_renameat2()
4409 old_dentry = __lookup_hash(&old_last, old_path.dentry, lookup_flags); in do_renameat2()
4417 new_dentry = __lookup_hash(&new_last, new_path.dentry, lookup_flags | target_flags); in do_renameat2()
4457 error = vfs_rename(old_path.dentry->d_inode, old_dentry, in do_renameat2()
4458 new_path.dentry->d_inode, new_dentry, in do_renameat2()
4465 unlock_rename(new_path.dentry, old_path.dentry); in do_renameat2()
4531 int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen) in vfs_readlink() argument
4533 struct inode *inode = d_inode(dentry); in vfs_readlink()
4540 return inode->i_op->readlink(dentry, buffer, buflen); in vfs_readlink()
4542 if (!d_is_symlink(dentry)) in vfs_readlink()
4552 link = inode->i_op->get_link(dentry, inode, &done); in vfs_readlink()
4573 const char *vfs_get_link(struct dentry *dentry, struct delayed_call *done) in vfs_get_link() argument
4576 struct inode *inode = d_inode(dentry); in vfs_get_link()
4578 if (d_is_symlink(dentry)) { in vfs_get_link()
4579 res = ERR_PTR(security_inode_readlink(dentry)); in vfs_get_link()
4581 res = inode->i_op->get_link(dentry, inode, done); in vfs_get_link()
4588 const char *page_get_link(struct dentry *dentry, struct inode *inode, in page_get_link() argument
4595 if (!dentry) { in page_get_link()
4623 int page_readlink(struct dentry *dentry, char __user *buffer, int buflen) in page_readlink() argument
4627 page_get_link(dentry, d_inode(dentry), in page_readlink()