Lines Matching refs:dentry
478 dget(path->dentry); in path_get()
490 dput(path->dentry); in path_put()
523 return is_subdir(path->dentry, mnt->mnt_root); in path_connected()
547 static int unlazy_walk(struct nameidata *nd, struct dentry *dentry) in unlazy_walk() argument
550 struct dentry *parent = nd->path.dentry; in unlazy_walk()
567 nd->path.dentry = NULL; in unlazy_walk()
582 if (!dentry) { in unlazy_walk()
587 if (!lockref_get_not_dead(&dentry->d_lockref)) in unlazy_walk()
589 if (read_seqcount_retry(&dentry->d_seq, nd->seq)) in unlazy_walk()
599 if (nd->root.mnt != fs->root.mnt || nd->root.dentry != fs->root.dentry) in unlazy_walk()
612 dput(dentry); in unlazy_walk()
622 static inline int d_revalidate(struct dentry *dentry, unsigned int flags) in d_revalidate() argument
624 return dentry->d_op->d_revalidate(dentry, flags); in d_revalidate()
639 struct dentry *dentry = nd->path.dentry; in complete_walk() local
651 if (unlikely(!lockref_get_not_dead(&dentry->d_lockref))) { in complete_walk()
656 if (read_seqcount_retry(&dentry->d_seq, nd->seq)) { in complete_walk()
658 dput(dentry); in complete_walk()
668 if (likely(!(dentry->d_flags & DCACHE_OP_WEAK_REVALIDATE))) in complete_walk()
671 status = dentry->d_op->d_weak_revalidate(dentry, nd->flags); in complete_walk()
697 res = __read_seqcount_begin(&nd->root.dentry->d_seq); in set_root_rcu()
704 dput(path->dentry); in path_put_conditional()
713 dput(nd->path.dentry); in path_to_nameidata()
718 nd->path.dentry = path->dentry; in path_to_nameidata()
730 nd->inode = nd->path.dentry->d_inode; in nd_jump_link()
748 struct inode *inode = link->dentry->d_inode; in put_link()
750 inode->i_op->put_link(link->dentry, nd, cookie); in put_link()
782 inode = link->dentry->d_inode; in may_follow_link()
787 parent = nd->path.dentry->d_inode; in may_follow_link()
857 inode = link->dentry->d_inode; in may_linkat()
873 struct dentry *dentry = link->dentry; in follow_link() local
892 error = security_inode_follow_link(link->dentry, nd); in follow_link()
897 *p = dentry->d_inode->i_op->follow_link(dentry, nd); in follow_link()
918 nd->inode = nd->path.dentry->d_inode; in follow_link()
937 struct dentry *mountpoint; in follow_up_rcu()
943 path->dentry = mountpoint; in follow_up_rcu()
962 struct dentry *mountpoint; in follow_up()
973 dput(path->dentry); in follow_up()
974 path->dentry = mountpoint; in follow_up()
992 if (!path->dentry->d_op || !path->dentry->d_op->d_automount) in follow_automount()
1008 path->dentry->d_inode) in follow_automount()
1015 mnt = path->dentry->d_op->d_automount(path); in follow_automount()
1048 path->dentry = dget(mnt->mnt_root); in follow_automount()
1076 while (managed = ACCESS_ONCE(path->dentry->d_flags), in follow_managed()
1082 BUG_ON(!path->dentry->d_op); in follow_managed()
1083 BUG_ON(!path->dentry->d_op->d_manage); in follow_managed()
1084 ret = path->dentry->d_op->d_manage(path->dentry, false); in follow_managed()
1093 dput(path->dentry); in follow_managed()
1097 path->dentry = dget(mounted->mnt_root); in follow_managed()
1133 dput(path->dentry); in follow_down_one()
1136 path->dentry = dget(mounted->mnt_root); in follow_down_one()
1143 static inline int managed_dentry_rcu(struct dentry *dentry) in managed_dentry_rcu() argument
1145 return (dentry->d_flags & DCACHE_MANAGE_TRANSIT) ? in managed_dentry_rcu()
1146 dentry->d_op->d_manage(dentry, true) : 0; in managed_dentry_rcu()
1162 switch (managed_dentry_rcu(path->dentry)) { in __follow_mount_rcu()
1172 if (!d_mountpoint(path->dentry)) in __follow_mount_rcu()
1173 return !(path->dentry->d_flags & DCACHE_NEED_AUTOMOUNT); in __follow_mount_rcu()
1175 mounted = __lookup_mnt(path->mnt, path->dentry); in __follow_mount_rcu()
1179 path->dentry = mounted->mnt.mnt_root; in __follow_mount_rcu()
1181 nd->seq = read_seqcount_begin(&path->dentry->d_seq); in __follow_mount_rcu()
1187 *inode = path->dentry->d_inode; in __follow_mount_rcu()
1190 !(path->dentry->d_flags & DCACHE_NEED_AUTOMOUNT); in __follow_mount_rcu()
1200 if (nd->path.dentry == nd->root.dentry && in follow_dotdot_rcu()
1204 if (nd->path.dentry != nd->path.mnt->mnt_root) { in follow_dotdot_rcu()
1205 struct dentry *old = nd->path.dentry; in follow_dotdot_rcu()
1206 struct dentry *parent = old->d_parent; in follow_dotdot_rcu()
1213 nd->path.dentry = parent; in follow_dotdot_rcu()
1221 inode = nd->path.dentry->d_inode; in follow_dotdot_rcu()
1222 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); in follow_dotdot_rcu()
1224 while (d_mountpoint(nd->path.dentry)) { in follow_dotdot_rcu()
1226 mounted = __lookup_mnt(nd->path.mnt, nd->path.dentry); in follow_dotdot_rcu()
1230 nd->path.dentry = mounted->mnt.mnt_root; in follow_dotdot_rcu()
1231 inode = nd->path.dentry->d_inode; in follow_dotdot_rcu()
1232 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); in follow_dotdot_rcu()
1257 while (managed = ACCESS_ONCE(path->dentry->d_flags), in follow_down()
1270 BUG_ON(!path->dentry->d_op); in follow_down()
1271 BUG_ON(!path->dentry->d_op->d_manage); in follow_down()
1272 ret = path->dentry->d_op->d_manage( in follow_down()
1273 path->dentry, false); in follow_down()
1283 dput(path->dentry); in follow_down()
1286 path->dentry = dget(mounted->mnt_root); in follow_down()
1302 while (d_mountpoint(path->dentry)) { in follow_mount()
1306 dput(path->dentry); in follow_mount()
1309 path->dentry = dget(mounted->mnt_root); in follow_mount()
1319 struct dentry *old = nd->path.dentry; in follow_dotdot()
1321 if (nd->path.dentry == nd->root.dentry && in follow_dotdot()
1325 if (nd->path.dentry != nd->path.mnt->mnt_root) { in follow_dotdot()
1327 nd->path.dentry = dget_parent(nd->path.dentry); in follow_dotdot()
1339 nd->inode = nd->path.dentry->d_inode; in follow_dotdot()
1350 static struct dentry *lookup_dcache(struct qstr *name, struct dentry *dir, in lookup_dcache()
1353 struct dentry *dentry; in lookup_dcache() local
1357 dentry = d_lookup(dir, name); in lookup_dcache()
1358 if (dentry) { in lookup_dcache()
1359 if (dentry->d_flags & DCACHE_OP_REVALIDATE) { in lookup_dcache()
1360 error = d_revalidate(dentry, flags); in lookup_dcache()
1363 dput(dentry); in lookup_dcache()
1366 d_invalidate(dentry); in lookup_dcache()
1367 dput(dentry); in lookup_dcache()
1368 dentry = NULL; in lookup_dcache()
1374 if (!dentry) { in lookup_dcache()
1375 dentry = d_alloc(dir, name); in lookup_dcache()
1376 if (unlikely(!dentry)) in lookup_dcache()
1381 return dentry; in lookup_dcache()
1390 static struct dentry *lookup_real(struct inode *dir, struct dentry *dentry, in lookup_real() argument
1393 struct dentry *old; in lookup_real()
1397 dput(dentry); in lookup_real()
1401 old = dir->i_op->lookup(dir, dentry, flags); in lookup_real()
1403 dput(dentry); in lookup_real()
1404 dentry = old; in lookup_real()
1406 return dentry; in lookup_real()
1409 static struct dentry *__lookup_hash(struct qstr *name, in __lookup_hash()
1410 struct dentry *base, unsigned int flags) in __lookup_hash()
1413 struct dentry *dentry; in __lookup_hash() local
1415 dentry = lookup_dcache(name, base, flags, &need_lookup); in __lookup_hash()
1417 return dentry; in __lookup_hash()
1419 return lookup_real(base->d_inode, dentry, flags); in __lookup_hash()
1431 struct dentry *dentry, *parent = nd->path.dentry; in lookup_fast() local
1444 dentry = __d_lookup_rcu(parent, &nd->last, &seq); in lookup_fast()
1445 if (!dentry) in lookup_fast()
1452 *inode = dentry->d_inode; in lookup_fast()
1453 negative = d_is_negative(dentry); in lookup_fast()
1454 if (read_seqcount_retry(&dentry->d_seq, seq)) in lookup_fast()
1468 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) { in lookup_fast()
1469 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1483 path->dentry = dentry; in lookup_fast()
1487 if (unlazy_walk(nd, dentry)) in lookup_fast()
1490 dentry = __d_lookup(parent, &nd->last); in lookup_fast()
1493 if (unlikely(!dentry)) in lookup_fast()
1496 if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval) in lookup_fast()
1497 status = d_revalidate(dentry, nd->flags); in lookup_fast()
1500 dput(dentry); in lookup_fast()
1503 d_invalidate(dentry); in lookup_fast()
1504 dput(dentry); in lookup_fast()
1508 if (unlikely(d_is_negative(dentry))) { in lookup_fast()
1509 dput(dentry); in lookup_fast()
1513 path->dentry = dentry; in lookup_fast()
1521 *inode = path->dentry->d_inode; in lookup_fast()
1531 struct dentry *dentry, *parent; in lookup_slow() local
1534 parent = nd->path.dentry; in lookup_slow()
1538 dentry = __lookup_hash(&nd->last, parent, nd->flags); in lookup_slow()
1540 if (IS_ERR(dentry)) in lookup_slow()
1541 return PTR_ERR(dentry); in lookup_slow()
1543 path->dentry = dentry; in lookup_slow()
1596 static inline int should_follow_link(struct dentry *dentry, int follow) in should_follow_link() argument
1598 return unlikely(d_is_symlink(dentry)) ? follow : 0; in should_follow_link()
1623 if (d_is_negative(path->dentry)) in walk_component()
1625 inode = path->dentry->d_inode; in walk_component()
1628 if (should_follow_link(path->dentry, follow)) { in walk_component()
1631 unlazy_walk(nd, path->dentry))) { in walk_component()
1636 BUG_ON(inode != path->dentry->d_inode); in walk_component()
1844 struct dentry *parent = nd->path.dentry; in link_path_walk()
1882 if (!d_can_lookup(nd->path.dentry)) { in link_path_walk()
1902 struct dentry *root = nd->root.dentry; in path_init()
1915 nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
1945 nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
1953 struct dentry *dentry; in path_init() local
1958 dentry = f.file->f_path.dentry; in path_init()
1961 if (!d_can_lookup(dentry)) { in path_init()
1971 nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); in path_init()
1979 nd->inode = nd->path.dentry->d_inode; in path_init()
1982 if (likely(!read_seqcount_retry(&nd->path.dentry->d_seq, nd->seq))) in path_init()
2055 if (!d_can_lookup(nd->path.dentry)) { in path_lookupat()
2075 audit_inode(name, nd->path.dentry, flags & LOOKUP_PARENT); in filename_lookup()
2080 struct dentry *kern_path_locked(const char *name, struct path *path) in kern_path_locked()
2084 struct dentry *d; in kern_path_locked()
2100 mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); in kern_path_locked()
2101 d = __lookup_hash(&nd.last, nd.path.dentry, 0); in kern_path_locked()
2103 mutex_unlock(&nd.path.dentry->d_inode->i_mutex); in kern_path_locked()
2137 int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, in vfs_path_lookup() argument
2149 nd.root.dentry = dentry; in vfs_path_lookup()
2166 static struct dentry *lookup_hash(struct nameidata *nd) in lookup_hash()
2168 return __lookup_hash(&nd->last, nd->path.dentry, nd->flags); in lookup_hash()
2180 struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) in lookup_one_len()
2306 struct dentry *dentry; in mountpoint_last() local
2307 struct dentry *dir = nd->path.dentry; in mountpoint_last()
2323 dentry = dget(nd->path.dentry); in mountpoint_last()
2328 dentry = d_lookup(dir, &nd->last); in mountpoint_last()
2329 if (!dentry) { in mountpoint_last()
2335 dentry = d_alloc(dir, &nd->last); in mountpoint_last()
2336 if (!dentry) { in mountpoint_last()
2341 dentry = lookup_real(dir->d_inode, dentry, nd->flags); in mountpoint_last()
2342 error = PTR_ERR(dentry); in mountpoint_last()
2343 if (IS_ERR(dentry)) { in mountpoint_last()
2351 if (d_is_negative(dentry)) { in mountpoint_last()
2353 dput(dentry); in mountpoint_last()
2356 path->dentry = dentry; in mountpoint_last()
2358 if (should_follow_link(dentry, nd->flags & LOOKUP_FOLLOW)) in mountpoint_last()
2421 audit_inode(name, path->dentry, 0); in filename_mountpoint()
2486 static int may_delete(struct inode *dir, struct dentry *victim, bool isdir) in may_delete()
2529 static inline int may_create(struct inode *dir, struct dentry *child) in may_create()
2542 struct dentry *lock_rename(struct dentry *p1, struct dentry *p2) in lock_rename()
2544 struct dentry *p; in lock_rename()
2573 void unlock_rename(struct dentry *p1, struct dentry *p2) in unlock_rename()
2583 int vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, in vfs_create() argument
2586 int error = may_create(dir, dentry); in vfs_create()
2594 error = security_inode_create(dir, dentry, mode); in vfs_create()
2597 error = dir->i_op->create(dir, dentry, mode, want_excl); in vfs_create()
2599 fsnotify_create(dir, dentry); in vfs_create()
2606 struct dentry *dentry = path->dentry; in may_open() local
2607 struct inode *inode = dentry->d_inode; in may_open()
2659 struct inode *inode = path->dentry->d_inode; in handle_truncate()
2670 error = do_truncate(path->dentry, 0, in handle_truncate()
2685 static int may_o_create(struct path *dir, struct dentry *dentry, umode_t mode) in may_o_create() argument
2687 int error = security_path_mknod(dir, dentry, mode, 0); in may_o_create()
2691 error = inode_permission(dir->dentry->d_inode, MAY_WRITE | MAY_EXEC); in may_o_create()
2695 return security_inode_create(dir->dentry->d_inode, dentry, mode); in may_o_create()
2711 static int atomic_open(struct nameidata *nd, struct dentry *dentry, in atomic_open() argument
2717 struct inode *dir = nd->path.dentry->d_inode; in atomic_open()
2723 struct dentry *const DENTRY_NOT_SET = (void *) -1UL; in atomic_open()
2726 BUG_ON(dentry->d_inode); in atomic_open()
2771 error = may_o_create(&nd->path, dentry, mode); in atomic_open()
2783 file->f_path.dentry = DENTRY_NOT_SET; in atomic_open()
2785 error = dir->i_op->atomic_open(dir, dentry, file, open_flag, mode, in atomic_open()
2794 if (WARN_ON(file->f_path.dentry == DENTRY_NOT_SET)) { in atomic_open()
2798 if (file->f_path.dentry) { in atomic_open()
2799 dput(dentry); in atomic_open()
2800 dentry = file->f_path.dentry; in atomic_open()
2803 fsnotify_create(dir, dentry); in atomic_open()
2804 if (!dentry->d_inode) { in atomic_open()
2826 fsnotify_create(dir, dentry); in atomic_open()
2834 dput(dentry); in atomic_open()
2839 dentry = lookup_real(dir, dentry, nd->flags); in atomic_open()
2840 if (IS_ERR(dentry)) in atomic_open()
2841 return PTR_ERR(dentry); in atomic_open()
2843 if (create_error && !dentry->d_inode) { in atomic_open()
2848 path->dentry = dentry; in atomic_open()
2876 struct dentry *dir = nd->path.dentry; in lookup_open()
2878 struct dentry *dentry; in lookup_open() local
2883 dentry = lookup_dcache(&nd->last, dir, nd->flags, &need_lookup); in lookup_open()
2884 if (IS_ERR(dentry)) in lookup_open()
2885 return PTR_ERR(dentry); in lookup_open()
2888 if (!need_lookup && dentry->d_inode) in lookup_open()
2892 return atomic_open(nd, dentry, path, file, op, got_write, in lookup_open()
2897 BUG_ON(dentry->d_inode); in lookup_open()
2899 dentry = lookup_real(dir_inode, dentry, nd->flags); in lookup_open()
2900 if (IS_ERR(dentry)) in lookup_open()
2901 return PTR_ERR(dentry); in lookup_open()
2905 if (!dentry->d_inode && (op->open_flag & O_CREAT)) { in lookup_open()
2921 error = security_path_mknod(&nd->path, dentry, mode, 0); in lookup_open()
2924 error = vfs_create(dir->d_inode, dentry, mode, in lookup_open()
2930 path->dentry = dentry; in lookup_open()
2935 dput(dentry); in lookup_open()
2946 struct dentry *dir = nd->path.dentry; in do_last()
2953 struct path save_parent = { .dentry = NULL, .mnt = NULL }; in do_last()
3022 audit_inode(name, file->f_path.dentry, 0); in do_last()
3038 if (d_is_positive(path->dentry)) in do_last()
3039 audit_inode(name, path->dentry, 0); in do_last()
3063 inode = path->dentry->d_inode; in do_last()
3065 if (d_is_negative(path->dentry)) { in do_last()
3069 inode = path->dentry->d_inode; in do_last()
3072 if (should_follow_link(path->dentry, !symlink_ok)) { in do_last()
3075 unlazy_walk(nd, path->dentry))) { in do_last()
3080 BUG_ON(inode != path->dentry->d_inode); in do_last()
3087 save_parent.dentry = nd->path.dentry; in do_last()
3089 nd->path.dentry = path->dentry; in do_last()
3100 audit_inode(name, nd->path.dentry, 0); in do_last()
3102 if ((open_flag & O_CREAT) && d_is_dir(nd->path.dentry)) in do_last()
3105 if ((nd->flags & LOOKUP_DIRECTORY) && !d_can_lookup(nd->path.dentry)) in do_last()
3107 if (!d_is_reg(nd->path.dentry)) in do_last()
3163 if (!save_parent.dentry || retried) in do_last()
3166 BUG_ON(save_parent.dentry != dir); in do_last()
3171 save_parent.dentry = NULL; in do_last()
3186 struct dentry *dentry, *child; in do_tmpfile() local
3199 dentry = nd->path.dentry; in do_tmpfile()
3200 dir = dentry->d_inode; in do_tmpfile()
3205 child = d_alloc(dentry, &name); in do_tmpfile()
3212 dput(nd->path.dentry); in do_tmpfile()
3213 nd->path.dentry = child; in do_tmpfile()
3214 error = dir->i_op->tmpfile(dir, nd->path.dentry, op->mode); in do_tmpfile()
3217 audit_inode(pathname, nd->path.dentry, 0); in do_tmpfile()
3223 error = finish_open(file, nd->path.dentry, NULL, opened); in do_tmpfile()
3320 struct file *do_file_open_root(struct dentry *dentry, struct vfsmount *mnt, in do_file_open_root() argument
3329 nd.root.dentry = dentry; in do_file_open_root()
3331 if (d_is_symlink(dentry) && op->intent & LOOKUP_OPEN) in do_file_open_root()
3347 static struct dentry *filename_create(int dfd, struct filename *name, in filename_create()
3350 struct dentry *dentry = ERR_PTR(-EEXIST); in filename_create() local
3380 mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); in filename_create()
3381 dentry = lookup_hash(&nd); in filename_create()
3382 if (IS_ERR(dentry)) in filename_create()
3386 if (d_is_positive(dentry)) in filename_create()
3404 return dentry; in filename_create()
3406 dput(dentry); in filename_create()
3407 dentry = ERR_PTR(error); in filename_create()
3409 mutex_unlock(&nd.path.dentry->d_inode->i_mutex); in filename_create()
3414 return dentry; in filename_create()
3417 struct dentry *kern_path_create(int dfd, const char *pathname, in kern_path_create()
3421 struct dentry *res; in kern_path_create()
3431 void done_path_create(struct path *path, struct dentry *dentry) in done_path_create() argument
3433 dput(dentry); in done_path_create()
3434 mutex_unlock(&path->dentry->d_inode->i_mutex); in done_path_create()
3440 struct dentry *user_path_create(int dfd, const char __user *pathname, in user_path_create()
3444 struct dentry *res; in user_path_create()
3453 int vfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) in vfs_mknod() argument
3455 int error = may_create(dir, dentry); in vfs_mknod()
3470 error = security_inode_mknod(dir, dentry, mode, dev); in vfs_mknod()
3474 error = dir->i_op->mknod(dir, dentry, mode, dev); in vfs_mknod()
3476 fsnotify_create(dir, dentry); in vfs_mknod()
3501 struct dentry *dentry; in SYSCALL_DEFINE4() local
3510 dentry = user_path_create(dfd, filename, &path, lookup_flags); in SYSCALL_DEFINE4()
3511 if (IS_ERR(dentry)) in SYSCALL_DEFINE4()
3512 return PTR_ERR(dentry); in SYSCALL_DEFINE4()
3514 if (!IS_POSIXACL(path.dentry->d_inode)) in SYSCALL_DEFINE4()
3516 error = security_path_mknod(&path, dentry, mode, dev); in SYSCALL_DEFINE4()
3521 error = vfs_create(path.dentry->d_inode,dentry,mode,true); in SYSCALL_DEFINE4()
3524 error = vfs_mknod(path.dentry->d_inode,dentry,mode, in SYSCALL_DEFINE4()
3528 error = vfs_mknod(path.dentry->d_inode,dentry,mode,0); in SYSCALL_DEFINE4()
3532 done_path_create(&path, dentry); in SYSCALL_DEFINE4()
3545 int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) in vfs_mkdir() argument
3547 int error = may_create(dir, dentry); in vfs_mkdir()
3557 error = security_inode_mkdir(dir, dentry, mode); in vfs_mkdir()
3564 error = dir->i_op->mkdir(dir, dentry, mode); in vfs_mkdir()
3566 fsnotify_mkdir(dir, dentry); in vfs_mkdir()
3573 struct dentry *dentry; in SYSCALL_DEFINE3() local
3579 dentry = user_path_create(dfd, pathname, &path, lookup_flags); in SYSCALL_DEFINE3()
3580 if (IS_ERR(dentry)) in SYSCALL_DEFINE3()
3581 return PTR_ERR(dentry); in SYSCALL_DEFINE3()
3583 if (!IS_POSIXACL(path.dentry->d_inode)) in SYSCALL_DEFINE3()
3585 error = security_path_mkdir(&path, dentry, mode); in SYSCALL_DEFINE3()
3587 error = vfs_mkdir(path.dentry->d_inode, dentry, mode); in SYSCALL_DEFINE3()
3588 done_path_create(&path, dentry); in SYSCALL_DEFINE3()
3616 void dentry_unhash(struct dentry *dentry) in dentry_unhash() argument
3618 shrink_dcache_parent(dentry); in dentry_unhash()
3619 spin_lock(&dentry->d_lock); in dentry_unhash()
3620 if (dentry->d_lockref.count == 1) in dentry_unhash()
3621 __d_drop(dentry); in dentry_unhash()
3622 spin_unlock(&dentry->d_lock); in dentry_unhash()
3626 int vfs_rmdir(struct inode *dir, struct dentry *dentry) in vfs_rmdir() argument
3628 int error = may_delete(dir, dentry, 1); in vfs_rmdir()
3636 dget(dentry); in vfs_rmdir()
3637 mutex_lock(&dentry->d_inode->i_mutex); in vfs_rmdir()
3640 if (is_local_mountpoint(dentry)) in vfs_rmdir()
3643 error = security_inode_rmdir(dir, dentry); in vfs_rmdir()
3647 shrink_dcache_parent(dentry); in vfs_rmdir()
3648 error = dir->i_op->rmdir(dir, dentry); in vfs_rmdir()
3652 dentry->d_inode->i_flags |= S_DEAD; in vfs_rmdir()
3653 dont_mount(dentry); in vfs_rmdir()
3654 detach_mounts(dentry); in vfs_rmdir()
3657 mutex_unlock(&dentry->d_inode->i_mutex); in vfs_rmdir()
3658 dput(dentry); in vfs_rmdir()
3660 d_delete(dentry); in vfs_rmdir()
3669 struct dentry *dentry; in do_rmdir() local
3694 mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); in do_rmdir()
3695 dentry = lookup_hash(&nd); in do_rmdir()
3696 error = PTR_ERR(dentry); in do_rmdir()
3697 if (IS_ERR(dentry)) in do_rmdir()
3699 if (!dentry->d_inode) { in do_rmdir()
3703 error = security_path_rmdir(&nd.path, dentry); in do_rmdir()
3706 error = vfs_rmdir(nd.path.dentry->d_inode, dentry); in do_rmdir()
3708 dput(dentry); in do_rmdir()
3710 mutex_unlock(&nd.path.dentry->d_inode->i_mutex); in do_rmdir()
3745 int vfs_unlink(struct inode *dir, struct dentry *dentry, struct inode **delegated_inode) in vfs_unlink() argument
3747 struct inode *target = dentry->d_inode; in vfs_unlink()
3748 int error = may_delete(dir, dentry, 0); in vfs_unlink()
3757 if (is_local_mountpoint(dentry)) in vfs_unlink()
3760 error = security_inode_unlink(dir, dentry); in vfs_unlink()
3765 error = dir->i_op->unlink(dir, dentry); in vfs_unlink()
3767 dont_mount(dentry); in vfs_unlink()
3768 detach_mounts(dentry); in vfs_unlink()
3776 if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { in vfs_unlink()
3778 d_delete(dentry); in vfs_unlink()
3795 struct dentry *dentry; in do_unlinkat() local
3814 mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); in do_unlinkat()
3815 dentry = lookup_hash(&nd); in do_unlinkat()
3816 error = PTR_ERR(dentry); in do_unlinkat()
3817 if (!IS_ERR(dentry)) { in do_unlinkat()
3821 inode = dentry->d_inode; in do_unlinkat()
3822 if (d_is_negative(dentry)) in do_unlinkat()
3825 error = security_path_unlink(&nd.path, dentry); in do_unlinkat()
3828 error = vfs_unlink(nd.path.dentry->d_inode, dentry, &delegated_inode); in do_unlinkat()
3830 dput(dentry); in do_unlinkat()
3832 mutex_unlock(&nd.path.dentry->d_inode->i_mutex); in do_unlinkat()
3853 if (d_is_negative(dentry)) in do_unlinkat()
3855 else if (d_is_dir(dentry)) in do_unlinkat()
3878 int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname) in vfs_symlink() argument
3880 int error = may_create(dir, dentry); in vfs_symlink()
3888 error = security_inode_symlink(dir, dentry, oldname); in vfs_symlink()
3892 error = dir->i_op->symlink(dir, dentry, oldname); in vfs_symlink()
3894 fsnotify_create(dir, dentry); in vfs_symlink()
3904 struct dentry *dentry; in SYSCALL_DEFINE3() local
3912 dentry = user_path_create(newdfd, newname, &path, lookup_flags); in SYSCALL_DEFINE3()
3913 error = PTR_ERR(dentry); in SYSCALL_DEFINE3()
3914 if (IS_ERR(dentry)) in SYSCALL_DEFINE3()
3917 error = security_path_symlink(&path, dentry, from->name); in SYSCALL_DEFINE3()
3919 error = vfs_symlink(path.dentry->d_inode, dentry, from->name); in SYSCALL_DEFINE3()
3920 done_path_create(&path, dentry); in SYSCALL_DEFINE3()
3954 int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry, struct inode … in vfs_link()
4020 struct dentry *new_dentry; in SYSCALL_DEFINE5()
4058 error = security_path_link(old_path.dentry, &new_path, new_dentry); in SYSCALL_DEFINE5()
4061 error = vfs_link(old_path.dentry, new_path.dentry->d_inode, new_dentry, &delegated_inode); in SYSCALL_DEFINE5()
4136 int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, in vfs_rename()
4137 struct inode *new_dir, struct dentry *new_dentry, in vfs_rename()
4273 struct dentry *old_dir, *new_dir; in SYSCALL_DEFINE5()
4274 struct dentry *old_dentry, *new_dentry; in SYSCALL_DEFINE5()
4275 struct dentry *trap; in SYSCALL_DEFINE5()
4311 old_dir = oldnd.path.dentry; in SYSCALL_DEFINE5()
4316 new_dir = newnd.path.dentry; in SYSCALL_DEFINE5()
4425 int vfs_whiteout(struct inode *dir, struct dentry *dentry) in vfs_whiteout() argument
4427 int error = may_create(dir, dentry); in vfs_whiteout()
4434 return dir->i_op->mknod(dir, dentry, in vfs_whiteout()
4460 int generic_readlink(struct dentry *dentry, char __user *buffer, int buflen) in generic_readlink() argument
4467 cookie = dentry->d_inode->i_op->follow_link(dentry, &nd); in generic_readlink()
4472 if (dentry->d_inode->i_op->put_link) in generic_readlink()
4473 dentry->d_inode->i_op->put_link(dentry, &nd, cookie); in generic_readlink()
4479 static char *page_getlink(struct dentry * dentry, struct page **ppage) in page_getlink() argument
4483 struct address_space *mapping = dentry->d_inode->i_mapping; in page_getlink()
4489 nd_terminate_link(kaddr, dentry->d_inode->i_size, PAGE_SIZE - 1); in page_getlink()
4493 int page_readlink(struct dentry *dentry, char __user *buffer, int buflen) in page_readlink() argument
4496 int res = readlink_copy(buffer, buflen, page_getlink(dentry, &page)); in page_readlink()
4505 void *page_follow_link_light(struct dentry *dentry, struct nameidata *nd) in page_follow_link_light() argument
4508 nd_set_link(nd, page_getlink(dentry, &page)); in page_follow_link_light()
4513 void page_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie) in page_put_link() argument