Lines Matching refs:dentry
109 static inline struct hlist_bl_head *in_lookup_hash(const struct dentry *parent, in in_lookup_hash()
231 static inline int dentry_cmp(const struct dentry *dentry, const unsigned char *ct, unsigned tcount) in dentry_cmp() argument
249 const unsigned char *cs = READ_ONCE(dentry->d_name.name); in dentry_cmp()
262 static inline struct external_name *external_name(struct dentry *dentry) in external_name() argument
264 return container_of(dentry->d_name.name, struct external_name, name[0]); in external_name()
269 struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu); in __d_free() local
271 kmem_cache_free(dentry_cache, dentry); in __d_free()
276 struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu); in __d_free_external() local
277 kfree(external_name(dentry)); in __d_free_external()
278 kmem_cache_free(dentry_cache, dentry); in __d_free_external()
281 static inline int dname_external(const struct dentry *dentry) in dname_external() argument
283 return dentry->d_name.name != dentry->d_iname; in dname_external()
286 void take_dentry_name_snapshot(struct name_snapshot *name, struct dentry *dentry) in take_dentry_name_snapshot() argument
288 spin_lock(&dentry->d_lock); in take_dentry_name_snapshot()
289 name->name = dentry->d_name; in take_dentry_name_snapshot()
290 if (unlikely(dname_external(dentry))) { in take_dentry_name_snapshot()
291 atomic_inc(&external_name(dentry)->u.count); in take_dentry_name_snapshot()
293 memcpy(name->inline_name, dentry->d_iname, in take_dentry_name_snapshot()
294 dentry->d_name.len + 1); in take_dentry_name_snapshot()
297 spin_unlock(&dentry->d_lock); in take_dentry_name_snapshot()
312 static inline void __d_set_inode_and_type(struct dentry *dentry, in __d_set_inode_and_type() argument
318 dentry->d_inode = inode; in __d_set_inode_and_type()
319 flags = READ_ONCE(dentry->d_flags); in __d_set_inode_and_type()
322 smp_store_release(&dentry->d_flags, flags); in __d_set_inode_and_type()
325 static inline void __d_clear_type_and_inode(struct dentry *dentry) in __d_clear_type_and_inode() argument
327 unsigned flags = READ_ONCE(dentry->d_flags); in __d_clear_type_and_inode()
330 WRITE_ONCE(dentry->d_flags, flags); in __d_clear_type_and_inode()
331 dentry->d_inode = NULL; in __d_clear_type_and_inode()
332 if (dentry->d_flags & DCACHE_LRU_LIST) in __d_clear_type_and_inode()
336 static void dentry_free(struct dentry *dentry) in dentry_free() argument
338 WARN_ON(!hlist_unhashed(&dentry->d_u.d_alias)); in dentry_free()
339 if (unlikely(dname_external(dentry))) { in dentry_free()
340 struct external_name *p = external_name(dentry); in dentry_free()
342 call_rcu(&dentry->d_u.d_rcu, __d_free_external); in dentry_free()
347 if (dentry->d_flags & DCACHE_NORCU) in dentry_free()
348 __d_free(&dentry->d_u.d_rcu); in dentry_free()
350 call_rcu(&dentry->d_u.d_rcu, __d_free); in dentry_free()
357 static void dentry_unlink_inode(struct dentry * dentry) in dentry_unlink_inode() argument
358 __releases(dentry->d_lock) in dentry_unlink_inode()
359 __releases(dentry->d_inode->i_lock) in dentry_unlink_inode()
361 struct inode *inode = dentry->d_inode; in dentry_unlink_inode()
363 raw_write_seqcount_begin(&dentry->d_seq); in dentry_unlink_inode()
364 __d_clear_type_and_inode(dentry); in dentry_unlink_inode()
365 hlist_del_init(&dentry->d_u.d_alias); in dentry_unlink_inode()
366 raw_write_seqcount_end(&dentry->d_seq); in dentry_unlink_inode()
367 spin_unlock(&dentry->d_lock); in dentry_unlink_inode()
371 if (dentry->d_op && dentry->d_op->d_iput) in dentry_unlink_inode()
372 dentry->d_op->d_iput(dentry, inode); in dentry_unlink_inode()
396 #define D_FLAG_VERIFY(dentry,x) WARN_ON_ONCE(((dentry)->d_flags & (DCACHE_LRU_LIST | DCACHE_SHRINK_… argument
397 static void d_lru_add(struct dentry *dentry) in d_lru_add() argument
399 D_FLAG_VERIFY(dentry, 0); in d_lru_add()
400 dentry->d_flags |= DCACHE_LRU_LIST; in d_lru_add()
402 if (d_is_negative(dentry)) in d_lru_add()
404 WARN_ON_ONCE(!list_lru_add(&dentry->d_sb->s_dentry_lru, &dentry->d_lru)); in d_lru_add()
407 static void d_lru_del(struct dentry *dentry) in d_lru_del() argument
409 D_FLAG_VERIFY(dentry, DCACHE_LRU_LIST); in d_lru_del()
410 dentry->d_flags &= ~DCACHE_LRU_LIST; in d_lru_del()
412 if (d_is_negative(dentry)) in d_lru_del()
414 WARN_ON_ONCE(!list_lru_del(&dentry->d_sb->s_dentry_lru, &dentry->d_lru)); in d_lru_del()
417 static void d_shrink_del(struct dentry *dentry) in d_shrink_del() argument
419 D_FLAG_VERIFY(dentry, DCACHE_SHRINK_LIST | DCACHE_LRU_LIST); in d_shrink_del()
420 list_del_init(&dentry->d_lru); in d_shrink_del()
421 dentry->d_flags &= ~(DCACHE_SHRINK_LIST | DCACHE_LRU_LIST); in d_shrink_del()
425 static void d_shrink_add(struct dentry *dentry, struct list_head *list) in d_shrink_add() argument
427 D_FLAG_VERIFY(dentry, 0); in d_shrink_add()
428 list_add(&dentry->d_lru, list); in d_shrink_add()
429 dentry->d_flags |= DCACHE_SHRINK_LIST | DCACHE_LRU_LIST; in d_shrink_add()
439 static void d_lru_isolate(struct list_lru_one *lru, struct dentry *dentry) in d_lru_isolate() argument
441 D_FLAG_VERIFY(dentry, DCACHE_LRU_LIST); in d_lru_isolate()
442 dentry->d_flags &= ~DCACHE_LRU_LIST; in d_lru_isolate()
444 if (d_is_negative(dentry)) in d_lru_isolate()
446 list_lru_isolate(lru, &dentry->d_lru); in d_lru_isolate()
449 static void d_lru_shrink_move(struct list_lru_one *lru, struct dentry *dentry, in d_lru_shrink_move() argument
452 D_FLAG_VERIFY(dentry, DCACHE_LRU_LIST); in d_lru_shrink_move()
453 dentry->d_flags |= DCACHE_SHRINK_LIST; in d_lru_shrink_move()
454 if (d_is_negative(dentry)) in d_lru_shrink_move()
456 list_lru_isolate_move(lru, &dentry->d_lru, list); in d_lru_shrink_move()
476 static void ___d_drop(struct dentry *dentry) in ___d_drop() argument
484 if (unlikely(IS_ROOT(dentry))) in ___d_drop()
485 b = &dentry->d_sb->s_roots; in ___d_drop()
487 b = d_hash(dentry->d_name.hash); in ___d_drop()
490 __hlist_bl_del(&dentry->d_hash); in ___d_drop()
494 void __d_drop(struct dentry *dentry) in __d_drop() argument
496 if (!d_unhashed(dentry)) { in __d_drop()
497 ___d_drop(dentry); in __d_drop()
498 dentry->d_hash.pprev = NULL; in __d_drop()
499 write_seqcount_invalidate(&dentry->d_seq); in __d_drop()
504 void d_drop(struct dentry *dentry) in d_drop() argument
506 spin_lock(&dentry->d_lock); in d_drop()
507 __d_drop(dentry); in d_drop()
508 spin_unlock(&dentry->d_lock); in d_drop()
512 static inline void dentry_unlist(struct dentry *dentry, struct dentry *parent) in dentry_unlist() argument
514 struct dentry *next; in dentry_unlist()
519 dentry->d_flags |= DCACHE_DENTRY_KILLED; in dentry_unlist()
520 if (unlikely(list_empty(&dentry->d_child))) in dentry_unlist()
522 __list_del_entry(&dentry->d_child); in dentry_unlist()
542 while (dentry->d_child.next != &parent->d_subdirs) { in dentry_unlist()
543 next = list_entry(dentry->d_child.next, struct dentry, d_child); in dentry_unlist()
546 dentry->d_child.next = next->d_child.next; in dentry_unlist()
550 static void __dentry_kill(struct dentry *dentry) in __dentry_kill() argument
552 struct dentry *parent = NULL; in __dentry_kill()
554 if (!IS_ROOT(dentry)) in __dentry_kill()
555 parent = dentry->d_parent; in __dentry_kill()
560 lockref_mark_dead(&dentry->d_lockref); in __dentry_kill()
566 if (dentry->d_flags & DCACHE_OP_PRUNE) in __dentry_kill()
567 dentry->d_op->d_prune(dentry); in __dentry_kill()
569 if (dentry->d_flags & DCACHE_LRU_LIST) { in __dentry_kill()
570 if (!(dentry->d_flags & DCACHE_SHRINK_LIST)) in __dentry_kill()
571 d_lru_del(dentry); in __dentry_kill()
574 __d_drop(dentry); in __dentry_kill()
575 dentry_unlist(dentry, parent); in __dentry_kill()
578 if (dentry->d_inode) in __dentry_kill()
579 dentry_unlink_inode(dentry); in __dentry_kill()
581 spin_unlock(&dentry->d_lock); in __dentry_kill()
583 if (dentry->d_op && dentry->d_op->d_release) in __dentry_kill()
584 dentry->d_op->d_release(dentry); in __dentry_kill()
586 spin_lock(&dentry->d_lock); in __dentry_kill()
587 if (dentry->d_flags & DCACHE_SHRINK_LIST) { in __dentry_kill()
588 dentry->d_flags |= DCACHE_MAY_FREE; in __dentry_kill()
591 spin_unlock(&dentry->d_lock); in __dentry_kill()
593 dentry_free(dentry); in __dentry_kill()
597 static struct dentry *__lock_parent(struct dentry *dentry) in __lock_parent() argument
599 struct dentry *parent; in __lock_parent()
601 spin_unlock(&dentry->d_lock); in __lock_parent()
603 parent = READ_ONCE(dentry->d_parent); in __lock_parent()
613 if (unlikely(parent != dentry->d_parent)) { in __lock_parent()
618 if (parent != dentry) in __lock_parent()
619 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); in __lock_parent()
625 static inline struct dentry *lock_parent(struct dentry *dentry) in lock_parent() argument
627 struct dentry *parent = dentry->d_parent; in lock_parent()
628 if (IS_ROOT(dentry)) in lock_parent()
632 return __lock_parent(dentry); in lock_parent()
635 static inline bool retain_dentry(struct dentry *dentry) in retain_dentry() argument
637 WARN_ON(d_in_lookup(dentry)); in retain_dentry()
640 if (unlikely(d_unhashed(dentry))) in retain_dentry()
643 if (unlikely(dentry->d_flags & DCACHE_DISCONNECTED)) in retain_dentry()
646 if (unlikely(dentry->d_flags & DCACHE_OP_DELETE)) { in retain_dentry()
647 if (dentry->d_op->d_delete(dentry)) in retain_dentry()
651 if (unlikely(dentry->d_flags & DCACHE_DONTCACHE)) in retain_dentry()
655 dentry->d_lockref.count--; in retain_dentry()
656 if (unlikely(!(dentry->d_flags & DCACHE_LRU_LIST))) in retain_dentry()
657 d_lru_add(dentry); in retain_dentry()
658 else if (unlikely(!(dentry->d_flags & DCACHE_REFERENCED))) in retain_dentry()
659 dentry->d_flags |= DCACHE_REFERENCED; in retain_dentry()
665 struct dentry *de; in d_mark_dontcache()
683 static struct dentry *dentry_kill(struct dentry *dentry) in dentry_kill() argument
684 __releases(dentry->d_lock) in dentry_kill()
686 struct inode *inode = dentry->d_inode; in dentry_kill()
687 struct dentry *parent = NULL; in dentry_kill()
692 if (!IS_ROOT(dentry)) { in dentry_kill()
693 parent = dentry->d_parent; in dentry_kill()
695 parent = __lock_parent(dentry); in dentry_kill()
696 if (likely(inode || !dentry->d_inode)) in dentry_kill()
701 inode = dentry->d_inode; in dentry_kill()
705 __dentry_kill(dentry); in dentry_kill()
709 spin_unlock(&dentry->d_lock); in dentry_kill()
711 spin_lock(&dentry->d_lock); in dentry_kill()
712 parent = lock_parent(dentry); in dentry_kill()
714 if (unlikely(dentry->d_lockref.count != 1)) { in dentry_kill()
715 dentry->d_lockref.count--; in dentry_kill()
716 } else if (likely(!retain_dentry(dentry))) { in dentry_kill()
717 __dentry_kill(dentry); in dentry_kill()
725 spin_unlock(&dentry->d_lock); in dentry_kill()
737 static inline bool fast_dput(struct dentry *dentry) in fast_dput() argument
746 if (unlikely(dentry->d_flags & DCACHE_OP_DELETE)) in fast_dput()
747 return lockref_put_or_lock(&dentry->d_lockref); in fast_dput()
753 ret = lockref_put_return(&dentry->d_lockref); in fast_dput()
761 spin_lock(&dentry->d_lock); in fast_dput()
762 if (WARN_ON_ONCE(dentry->d_lockref.count <= 0)) { in fast_dput()
763 spin_unlock(&dentry->d_lock); in fast_dput()
766 dentry->d_lockref.count--; in fast_dput()
798 d_flags = READ_ONCE(dentry->d_flags); in fast_dput()
802 if (d_flags == (DCACHE_REFERENCED | DCACHE_LRU_LIST) && !d_unhashed(dentry)) in fast_dput()
810 spin_lock(&dentry->d_lock); in fast_dput()
819 if (dentry->d_lockref.count) { in fast_dput()
820 spin_unlock(&dentry->d_lock); in fast_dput()
829 dentry->d_lockref.count = 1; in fast_dput()
860 void dput(struct dentry *dentry) in dput() argument
862 while (dentry) { in dput()
866 if (likely(fast_dput(dentry))) { in dput()
874 if (likely(retain_dentry(dentry))) { in dput()
875 spin_unlock(&dentry->d_lock); in dput()
879 dentry = dentry_kill(dentry); in dput()
884 static void __dput_to_list(struct dentry *dentry, struct list_head *list) in __dput_to_list() argument
885 __must_hold(&dentry->d_lock) in __dput_to_list()
887 if (dentry->d_flags & DCACHE_SHRINK_LIST) { in __dput_to_list()
889 --dentry->d_lockref.count; in __dput_to_list()
891 if (dentry->d_flags & DCACHE_LRU_LIST) in __dput_to_list()
892 d_lru_del(dentry); in __dput_to_list()
893 if (!--dentry->d_lockref.count) in __dput_to_list()
894 d_shrink_add(dentry, list); in __dput_to_list()
898 void dput_to_list(struct dentry *dentry, struct list_head *list) in dput_to_list() argument
901 if (likely(fast_dput(dentry))) { in dput_to_list()
906 if (!retain_dentry(dentry)) in dput_to_list()
907 __dput_to_list(dentry, list); in dput_to_list()
908 spin_unlock(&dentry->d_lock); in dput_to_list()
912 static inline void __dget_dlock(struct dentry *dentry) in __dget_dlock() argument
914 dentry->d_lockref.count++; in __dget_dlock()
917 static inline void __dget(struct dentry *dentry) in __dget() argument
919 lockref_get(&dentry->d_lockref); in __dget()
922 struct dentry *dget_parent(struct dentry *dentry) in dget_parent() argument
925 struct dentry *ret; in dget_parent()
933 seq = raw_seqcount_begin(&dentry->d_seq); in dget_parent()
934 ret = READ_ONCE(dentry->d_parent); in dget_parent()
938 if (!read_seqcount_retry(&dentry->d_seq, seq)) in dget_parent()
949 ret = dentry->d_parent; in dget_parent()
951 if (unlikely(ret != dentry->d_parent)) { in dget_parent()
964 static struct dentry * __d_find_any_alias(struct inode *inode) in __d_find_any_alias()
966 struct dentry *alias; in __d_find_any_alias()
970 alias = hlist_entry(inode->i_dentry.first, struct dentry, d_u.d_alias); in __d_find_any_alias()
982 struct dentry *d_find_any_alias(struct inode *inode) in d_find_any_alias()
984 struct dentry *de; in d_find_any_alias()
1007 static struct dentry *__d_find_alias(struct inode *inode) in __d_find_alias()
1009 struct dentry *alias; in __d_find_alias()
1026 struct dentry *d_find_alias(struct inode *inode) in d_find_alias()
1028 struct dentry *de = NULL; in d_find_alias()
1045 struct dentry *dentry; in d_prune_aliases() local
1048 hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) { in d_prune_aliases()
1049 spin_lock(&dentry->d_lock); in d_prune_aliases()
1050 if (!dentry->d_lockref.count) { in d_prune_aliases()
1051 struct dentry *parent = lock_parent(dentry); in d_prune_aliases()
1052 if (likely(!dentry->d_lockref.count)) { in d_prune_aliases()
1053 __dentry_kill(dentry); in d_prune_aliases()
1060 spin_unlock(&dentry->d_lock); in d_prune_aliases()
1077 static bool shrink_lock_dentry(struct dentry *dentry) in shrink_lock_dentry() argument
1080 struct dentry *parent; in shrink_lock_dentry()
1082 if (dentry->d_lockref.count) in shrink_lock_dentry()
1085 inode = dentry->d_inode; in shrink_lock_dentry()
1087 spin_unlock(&dentry->d_lock); in shrink_lock_dentry()
1089 spin_lock(&dentry->d_lock); in shrink_lock_dentry()
1090 if (unlikely(dentry->d_lockref.count)) in shrink_lock_dentry()
1093 if (unlikely(inode != dentry->d_inode)) in shrink_lock_dentry()
1097 parent = dentry->d_parent; in shrink_lock_dentry()
1098 if (IS_ROOT(dentry) || likely(spin_trylock(&parent->d_lock))) in shrink_lock_dentry()
1101 spin_unlock(&dentry->d_lock); in shrink_lock_dentry()
1103 if (unlikely(parent != dentry->d_parent)) { in shrink_lock_dentry()
1105 spin_lock(&dentry->d_lock); in shrink_lock_dentry()
1108 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); in shrink_lock_dentry()
1109 if (likely(!dentry->d_lockref.count)) in shrink_lock_dentry()
1121 struct dentry *dentry, *parent; in shrink_dentry_list() local
1123 dentry = list_entry(list->prev, struct dentry, d_lru); in shrink_dentry_list()
1124 spin_lock(&dentry->d_lock); in shrink_dentry_list()
1126 if (!shrink_lock_dentry(dentry)) { in shrink_dentry_list()
1129 d_shrink_del(dentry); in shrink_dentry_list()
1130 if (dentry->d_lockref.count < 0) in shrink_dentry_list()
1131 can_free = dentry->d_flags & DCACHE_MAY_FREE; in shrink_dentry_list()
1132 spin_unlock(&dentry->d_lock); in shrink_dentry_list()
1134 dentry_free(dentry); in shrink_dentry_list()
1138 d_shrink_del(dentry); in shrink_dentry_list()
1139 parent = dentry->d_parent; in shrink_dentry_list()
1140 if (parent != dentry) in shrink_dentry_list()
1142 __dentry_kill(dentry); in shrink_dentry_list()
1150 struct dentry *dentry = container_of(item, struct dentry, d_lru); in dentry_lru_isolate() local
1158 if (!spin_trylock(&dentry->d_lock)) in dentry_lru_isolate()
1166 if (dentry->d_lockref.count) { in dentry_lru_isolate()
1167 d_lru_isolate(lru, dentry); in dentry_lru_isolate()
1168 spin_unlock(&dentry->d_lock); in dentry_lru_isolate()
1172 if (dentry->d_flags & DCACHE_REFERENCED) { in dentry_lru_isolate()
1173 dentry->d_flags &= ~DCACHE_REFERENCED; in dentry_lru_isolate()
1174 spin_unlock(&dentry->d_lock); in dentry_lru_isolate()
1198 d_lru_shrink_move(lru, dentry, freeable); in dentry_lru_isolate()
1199 spin_unlock(&dentry->d_lock); in dentry_lru_isolate()
1231 struct dentry *dentry = container_of(item, struct dentry, d_lru); in dentry_lru_isolate_shrink() local
1238 if (!spin_trylock(&dentry->d_lock)) in dentry_lru_isolate_shrink()
1241 d_lru_shrink_move(lru, dentry, freeable); in dentry_lru_isolate_shrink()
1242 spin_unlock(&dentry->d_lock); in dentry_lru_isolate_shrink()
1289 static void d_walk(struct dentry *parent, void *data, in d_walk() argument
1290 enum d_walk_ret (*enter)(void *, struct dentry *)) in d_walk()
1292 struct dentry *this_parent; in d_walk()
1319 struct dentry *dentry = list_entry(tmp, struct dentry, d_child); in d_walk() local
1322 if (unlikely(dentry->d_flags & DCACHE_DENTRY_CURSOR)) in d_walk()
1325 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); in d_walk()
1327 ret = enter(data, dentry); in d_walk()
1332 spin_unlock(&dentry->d_lock); in d_walk()
1338 spin_unlock(&dentry->d_lock); in d_walk()
1342 if (!list_empty(&dentry->d_subdirs)) { in d_walk()
1344 spin_release(&dentry->d_lock.dep_map, _RET_IP_); in d_walk()
1345 this_parent = dentry; in d_walk()
1349 spin_unlock(&dentry->d_lock); in d_walk()
1357 struct dentry *child = this_parent; in d_walk()
1371 child = list_entry(next, struct dentry, d_child); in d_walk()
1400 static enum d_walk_ret path_check_mount(void *data, struct dentry *dentry) in path_check_mount() argument
1403 struct path path = { .mnt = info->mnt, .dentry = dentry }; in path_check_mount()
1405 if (likely(!d_mountpoint(dentry))) in path_check_mount()
1427 d_walk(parent->dentry, &data, path_check_mount); in path_has_submounts()
1442 int d_set_mounted(struct dentry *dentry) in d_set_mounted() argument
1444 struct dentry *p; in d_set_mounted()
1447 for (p = dentry->d_parent; !IS_ROOT(p); p = p->d_parent) { in d_set_mounted()
1456 spin_lock(&dentry->d_lock); in d_set_mounted()
1457 if (!d_unlinked(dentry)) { in d_set_mounted()
1459 if (!d_mountpoint(dentry)) { in d_set_mounted()
1460 dentry->d_flags |= DCACHE_MOUNTED; in d_set_mounted()
1464 spin_unlock(&dentry->d_lock); in d_set_mounted()
1486 struct dentry *start;
1489 struct dentry *victim;
1494 static enum d_walk_ret select_collect(void *_data, struct dentry *dentry) in select_collect() argument
1499 if (data->start == dentry) in select_collect()
1502 if (dentry->d_flags & DCACHE_SHRINK_LIST) { in select_collect()
1505 if (dentry->d_flags & DCACHE_LRU_LIST) in select_collect()
1506 d_lru_del(dentry); in select_collect()
1507 if (!dentry->d_lockref.count) { in select_collect()
1508 d_shrink_add(dentry, &data->dispose); in select_collect()
1523 static enum d_walk_ret select_collect2(void *_data, struct dentry *dentry) in select_collect2() argument
1528 if (data->start == dentry) in select_collect2()
1531 if (dentry->d_flags & DCACHE_SHRINK_LIST) { in select_collect2()
1532 if (!dentry->d_lockref.count) { in select_collect2()
1534 data->victim = dentry; in select_collect2()
1538 if (dentry->d_flags & DCACHE_LRU_LIST) in select_collect2()
1539 d_lru_del(dentry); in select_collect2()
1540 if (!dentry->d_lockref.count) in select_collect2()
1541 d_shrink_add(dentry, &data->dispose); in select_collect2()
1560 void shrink_dcache_parent(struct dentry *parent) in shrink_dcache_parent()
1579 struct dentry *parent; in shrink_dcache_parent()
1598 static enum d_walk_ret umount_check(void *_data, struct dentry *dentry) in umount_check() argument
1601 if (!list_empty(&dentry->d_subdirs)) in umount_check()
1605 if (dentry == _data && dentry->d_lockref.count == 1) in umount_check()
1610 dentry, in umount_check()
1611 dentry->d_inode ? in umount_check()
1612 dentry->d_inode->i_ino : 0UL, in umount_check()
1613 dentry, in umount_check()
1614 dentry->d_lockref.count, in umount_check()
1615 dentry->d_sb->s_type->name, in umount_check()
1616 dentry->d_sb->s_id); in umount_check()
1621 static void do_one_tree(struct dentry *dentry) in do_one_tree() argument
1623 shrink_dcache_parent(dentry); in do_one_tree()
1624 d_walk(dentry, dentry, umount_check); in do_one_tree()
1625 d_drop(dentry); in do_one_tree()
1626 dput(dentry); in do_one_tree()
1634 struct dentry *dentry; in shrink_dcache_for_umount() local
1638 dentry = sb->s_root; in shrink_dcache_for_umount()
1640 do_one_tree(dentry); in shrink_dcache_for_umount()
1643 dentry = dget(hlist_bl_entry(hlist_bl_first(&sb->s_roots), struct dentry, d_hash)); in shrink_dcache_for_umount()
1644 do_one_tree(dentry); in shrink_dcache_for_umount()
1648 static enum d_walk_ret find_submount(void *_data, struct dentry *dentry) in find_submount() argument
1650 struct dentry **victim = _data; in find_submount()
1651 if (d_mountpoint(dentry)) { in find_submount()
1652 __dget_dlock(dentry); in find_submount()
1653 *victim = dentry; in find_submount()
1663 void d_invalidate(struct dentry *dentry) in d_invalidate() argument
1666 spin_lock(&dentry->d_lock); in d_invalidate()
1667 if (d_unhashed(dentry)) { in d_invalidate()
1668 spin_unlock(&dentry->d_lock); in d_invalidate()
1671 __d_drop(dentry); in d_invalidate()
1672 spin_unlock(&dentry->d_lock); in d_invalidate()
1675 if (!dentry->d_inode) in d_invalidate()
1678 shrink_dcache_parent(dentry); in d_invalidate()
1680 struct dentry *victim = NULL; in d_invalidate()
1681 d_walk(dentry, &victim, find_submount); in d_invalidate()
1684 shrink_dcache_parent(dentry); in d_invalidate()
1704 static struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) in __d_alloc()
1706 struct dentry *dentry; in __d_alloc() local
1710 dentry = kmem_cache_alloc(dentry_cache, GFP_KERNEL); in __d_alloc()
1711 if (!dentry) in __d_alloc()
1720 dentry->d_iname[DNAME_INLINE_LEN-1] = 0; in __d_alloc()
1723 dname = dentry->d_iname; in __d_alloc()
1730 kmem_cache_free(dentry_cache, dentry); in __d_alloc()
1736 dname = dentry->d_iname; in __d_alloc()
1739 dentry->d_name.len = name->len; in __d_alloc()
1740 dentry->d_name.hash = name->hash; in __d_alloc()
1745 smp_store_release(&dentry->d_name.name, dname); /* ^^^ */ in __d_alloc()
1747 dentry->d_lockref.count = 1; in __d_alloc()
1748 dentry->d_flags = 0; in __d_alloc()
1749 spin_lock_init(&dentry->d_lock); in __d_alloc()
1750 seqcount_spinlock_init(&dentry->d_seq, &dentry->d_lock); in __d_alloc()
1751 dentry->d_inode = NULL; in __d_alloc()
1752 dentry->d_parent = dentry; in __d_alloc()
1753 dentry->d_sb = sb; in __d_alloc()
1754 dentry->d_op = NULL; in __d_alloc()
1755 dentry->d_fsdata = NULL; in __d_alloc()
1756 INIT_HLIST_BL_NODE(&dentry->d_hash); in __d_alloc()
1757 INIT_LIST_HEAD(&dentry->d_lru); in __d_alloc()
1758 INIT_LIST_HEAD(&dentry->d_subdirs); in __d_alloc()
1759 INIT_HLIST_NODE(&dentry->d_u.d_alias); in __d_alloc()
1760 INIT_LIST_HEAD(&dentry->d_child); in __d_alloc()
1761 d_set_d_op(dentry, dentry->d_sb->s_d_op); in __d_alloc()
1763 if (dentry->d_op && dentry->d_op->d_init) { in __d_alloc()
1764 err = dentry->d_op->d_init(dentry); in __d_alloc()
1766 if (dname_external(dentry)) in __d_alloc()
1767 kfree(external_name(dentry)); in __d_alloc()
1768 kmem_cache_free(dentry_cache, dentry); in __d_alloc()
1775 return dentry; in __d_alloc()
1787 struct dentry *d_alloc(struct dentry * parent, const struct qstr *name) in d_alloc()
1789 struct dentry *dentry = __d_alloc(parent->d_sb, name); in d_alloc() local
1790 if (!dentry) in d_alloc()
1798 dentry->d_parent = parent; in d_alloc()
1799 list_add(&dentry->d_child, &parent->d_subdirs); in d_alloc()
1802 return dentry; in d_alloc()
1806 struct dentry *d_alloc_anon(struct super_block *sb) in d_alloc_anon()
1812 struct dentry *d_alloc_cursor(struct dentry * parent) in d_alloc_cursor()
1814 struct dentry *dentry = d_alloc_anon(parent->d_sb); in d_alloc_cursor() local
1815 if (dentry) { in d_alloc_cursor()
1816 dentry->d_flags |= DCACHE_DENTRY_CURSOR; in d_alloc_cursor()
1817 dentry->d_parent = dget(parent); in d_alloc_cursor()
1819 return dentry; in d_alloc_cursor()
1837 struct dentry *d_alloc_pseudo(struct super_block *sb, const struct qstr *name) in d_alloc_pseudo()
1839 struct dentry *dentry = __d_alloc(sb, name); in d_alloc_pseudo() local
1840 if (likely(dentry)) in d_alloc_pseudo()
1841 dentry->d_flags |= DCACHE_NORCU; in d_alloc_pseudo()
1842 return dentry; in d_alloc_pseudo()
1845 struct dentry *d_alloc_name(struct dentry *parent, const char *name) in d_alloc_name()
1855 void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op) in d_set_d_op() argument
1857 WARN_ON_ONCE(dentry->d_op); in d_set_d_op()
1858 WARN_ON_ONCE(dentry->d_flags & (DCACHE_OP_HASH | in d_set_d_op()
1864 dentry->d_op = op; in d_set_d_op()
1868 dentry->d_flags |= DCACHE_OP_HASH; in d_set_d_op()
1870 dentry->d_flags |= DCACHE_OP_COMPARE; in d_set_d_op()
1872 dentry->d_flags |= DCACHE_OP_REVALIDATE; in d_set_d_op()
1874 dentry->d_flags |= DCACHE_OP_WEAK_REVALIDATE; in d_set_d_op()
1876 dentry->d_flags |= DCACHE_OP_DELETE; in d_set_d_op()
1878 dentry->d_flags |= DCACHE_OP_PRUNE; in d_set_d_op()
1880 dentry->d_flags |= DCACHE_OP_REAL; in d_set_d_op()
1893 void d_set_fallthru(struct dentry *dentry) in d_set_fallthru() argument
1895 spin_lock(&dentry->d_lock); in d_set_fallthru()
1896 dentry->d_flags |= DCACHE_FALLTHRU; in d_set_fallthru()
1897 spin_unlock(&dentry->d_lock); in d_set_fallthru()
1936 static void __d_instantiate(struct dentry *dentry, struct inode *inode) in __d_instantiate() argument
1939 WARN_ON(d_in_lookup(dentry)); in __d_instantiate()
1941 spin_lock(&dentry->d_lock); in __d_instantiate()
1945 if (dentry->d_flags & DCACHE_LRU_LIST) in __d_instantiate()
1947 hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry); in __d_instantiate()
1948 raw_write_seqcount_begin(&dentry->d_seq); in __d_instantiate()
1949 __d_set_inode_and_type(dentry, inode, add_flags); in __d_instantiate()
1950 raw_write_seqcount_end(&dentry->d_seq); in __d_instantiate()
1951 fsnotify_update_flags(dentry); in __d_instantiate()
1952 spin_unlock(&dentry->d_lock); in __d_instantiate()
1970 void d_instantiate(struct dentry *entry, struct inode * inode) in d_instantiate()
1988 void d_instantiate_new(struct dentry *entry, struct inode *inode) in d_instantiate_new()
2004 struct dentry *d_make_root(struct inode *root_inode) in d_make_root()
2006 struct dentry *res = NULL; in d_make_root()
2019 static struct dentry *__d_instantiate_anon(struct dentry *dentry, in __d_instantiate_anon() argument
2023 struct dentry *res; in __d_instantiate_anon()
2026 security_d_instantiate(dentry, inode); in __d_instantiate_anon()
2031 dput(dentry); in __d_instantiate_anon()
2041 spin_lock(&dentry->d_lock); in __d_instantiate_anon()
2042 __d_set_inode_and_type(dentry, inode, add_flags); in __d_instantiate_anon()
2043 hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry); in __d_instantiate_anon()
2045 hlist_bl_lock(&dentry->d_sb->s_roots); in __d_instantiate_anon()
2046 hlist_bl_add_head(&dentry->d_hash, &dentry->d_sb->s_roots); in __d_instantiate_anon()
2047 hlist_bl_unlock(&dentry->d_sb->s_roots); in __d_instantiate_anon()
2049 spin_unlock(&dentry->d_lock); in __d_instantiate_anon()
2052 return dentry; in __d_instantiate_anon()
2059 struct dentry *d_instantiate_anon(struct dentry *dentry, struct inode *inode) in d_instantiate_anon() argument
2061 return __d_instantiate_anon(dentry, inode, true); in d_instantiate_anon()
2065 static struct dentry *__d_obtain_alias(struct inode *inode, bool disconnected) in __d_obtain_alias()
2067 struct dentry *tmp; in __d_obtain_alias()
2068 struct dentry *res; in __d_obtain_alias()
2110 struct dentry *d_obtain_alias(struct inode *inode) in d_obtain_alias()
2131 struct dentry *d_obtain_root(struct inode *inode) in d_obtain_root()
2153 struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode, in d_add_ci() argument
2156 struct dentry *found, *res; in d_add_ci()
2162 found = d_hash_and_lookup(dentry->d_parent, name); in d_add_ci()
2167 if (d_in_lookup(dentry)) { in d_add_ci()
2168 found = d_alloc_parallel(dentry->d_parent, name, in d_add_ci()
2169 dentry->d_wait); in d_add_ci()
2175 found = d_alloc(dentry->d_parent, name); in d_add_ci()
2191 static inline bool d_same_name(const struct dentry *dentry, in d_same_name() argument
2192 const struct dentry *parent, in d_same_name()
2196 if (dentry->d_name.len != name->len) in d_same_name()
2198 return dentry_cmp(dentry, name->name, name->len) == 0; in d_same_name()
2200 return parent->d_op->d_compare(dentry, in d_same_name()
2201 dentry->d_name.len, dentry->d_name.name, in d_same_name()
2234 struct dentry *__d_lookup_rcu(const struct dentry *parent, in __d_lookup_rcu()
2242 struct dentry *dentry; in __d_lookup_rcu() local
2264 hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) { in __d_lookup_rcu()
2285 seq = raw_seqcount_begin(&dentry->d_seq); in __d_lookup_rcu()
2286 if (dentry->d_parent != parent) in __d_lookup_rcu()
2288 if (d_unhashed(dentry)) in __d_lookup_rcu()
2294 if (dentry->d_name.hash != hashlen_hash(hashlen)) in __d_lookup_rcu()
2296 tlen = dentry->d_name.len; in __d_lookup_rcu()
2297 tname = dentry->d_name.name; in __d_lookup_rcu()
2299 if (read_seqcount_retry(&dentry->d_seq, seq)) { in __d_lookup_rcu()
2303 if (parent->d_op->d_compare(dentry, in __d_lookup_rcu()
2307 if (dentry->d_name.hash_len != hashlen) in __d_lookup_rcu()
2309 if (dentry_cmp(dentry, str, hashlen_len(hashlen)) != 0) in __d_lookup_rcu()
2313 return dentry; in __d_lookup_rcu()
2329 struct dentry *d_lookup(const struct dentry *parent, const struct qstr *name) in d_lookup()
2331 struct dentry *dentry; in d_lookup() local
2336 dentry = __d_lookup(parent, name); in d_lookup()
2337 if (dentry) in d_lookup()
2340 return dentry; in d_lookup()
2359 struct dentry *__d_lookup(const struct dentry *parent, const struct qstr *name) in __d_lookup()
2364 struct dentry *found = NULL; in __d_lookup()
2365 struct dentry *dentry; in __d_lookup() local
2389 hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) { in __d_lookup()
2391 if (dentry->d_name.hash != hash) in __d_lookup()
2394 spin_lock(&dentry->d_lock); in __d_lookup()
2395 if (dentry->d_parent != parent) in __d_lookup()
2397 if (d_unhashed(dentry)) in __d_lookup()
2400 if (!d_same_name(dentry, parent, name)) in __d_lookup()
2403 dentry->d_lockref.count++; in __d_lookup()
2404 found = dentry; in __d_lookup()
2405 spin_unlock(&dentry->d_lock); in __d_lookup()
2408 spin_unlock(&dentry->d_lock); in __d_lookup()
2422 struct dentry *d_hash_and_lookup(struct dentry *dir, struct qstr *name) in d_hash_and_lookup()
2460 void d_delete(struct dentry * dentry) in d_delete() argument
2462 struct inode *inode = dentry->d_inode; in d_delete()
2465 spin_lock(&dentry->d_lock); in d_delete()
2469 if (dentry->d_lockref.count == 1) { in d_delete()
2470 dentry->d_flags &= ~DCACHE_CANT_MOUNT; in d_delete()
2471 dentry_unlink_inode(dentry); in d_delete()
2473 __d_drop(dentry); in d_delete()
2474 spin_unlock(&dentry->d_lock); in d_delete()
2480 static void __d_rehash(struct dentry *entry) in __d_rehash()
2496 void d_rehash(struct dentry * entry) in d_rehash()
2520 static void d_wait_lookup(struct dentry *dentry) in d_wait_lookup() argument
2522 if (d_in_lookup(dentry)) { in d_wait_lookup()
2524 add_wait_queue(dentry->d_wait, &wait); in d_wait_lookup()
2527 spin_unlock(&dentry->d_lock); in d_wait_lookup()
2529 spin_lock(&dentry->d_lock); in d_wait_lookup()
2530 } while (d_in_lookup(dentry)); in d_wait_lookup()
2534 struct dentry *d_alloc_parallel(struct dentry *parent, in d_alloc_parallel()
2541 struct dentry *new = d_alloc(parent, name); in d_alloc_parallel()
2542 struct dentry *dentry; in d_alloc_parallel() local
2552 dentry = __d_lookup_rcu(parent, name, &d_seq); in d_alloc_parallel()
2553 if (unlikely(dentry)) { in d_alloc_parallel()
2554 if (!lockref_get_not_dead(&dentry->d_lockref)) { in d_alloc_parallel()
2558 if (read_seqcount_retry(&dentry->d_seq, d_seq)) { in d_alloc_parallel()
2560 dput(dentry); in d_alloc_parallel()
2565 return dentry; in d_alloc_parallel()
2590 hlist_bl_for_each_entry(dentry, node, b, d_u.d_in_lookup_hash) { in d_alloc_parallel()
2591 if (dentry->d_name.hash != hash) in d_alloc_parallel()
2593 if (dentry->d_parent != parent) in d_alloc_parallel()
2595 if (!d_same_name(dentry, parent, name)) in d_alloc_parallel()
2599 if (!lockref_get_not_dead(&dentry->d_lockref)) { in d_alloc_parallel()
2609 spin_lock(&dentry->d_lock); in d_alloc_parallel()
2610 d_wait_lookup(dentry); in d_alloc_parallel()
2617 if (unlikely(dentry->d_name.hash != hash)) in d_alloc_parallel()
2619 if (unlikely(dentry->d_parent != parent)) in d_alloc_parallel()
2621 if (unlikely(d_unhashed(dentry))) in d_alloc_parallel()
2623 if (unlikely(!d_same_name(dentry, parent, name))) in d_alloc_parallel()
2626 spin_unlock(&dentry->d_lock); in d_alloc_parallel()
2628 return dentry; in d_alloc_parallel()
2638 spin_unlock(&dentry->d_lock); in d_alloc_parallel()
2639 dput(dentry); in d_alloc_parallel()
2644 void __d_lookup_done(struct dentry *dentry) in __d_lookup_done() argument
2646 struct hlist_bl_head *b = in_lookup_hash(dentry->d_parent, in __d_lookup_done()
2647 dentry->d_name.hash); in __d_lookup_done()
2649 dentry->d_flags &= ~DCACHE_PAR_LOOKUP; in __d_lookup_done()
2650 __hlist_bl_del(&dentry->d_u.d_in_lookup_hash); in __d_lookup_done()
2651 wake_up_all(dentry->d_wait); in __d_lookup_done()
2652 dentry->d_wait = NULL; in __d_lookup_done()
2654 INIT_HLIST_NODE(&dentry->d_u.d_alias); in __d_lookup_done()
2655 INIT_LIST_HEAD(&dentry->d_lru); in __d_lookup_done()
2661 static inline void __d_add(struct dentry *dentry, struct inode *inode) in __d_add() argument
2665 spin_lock(&dentry->d_lock); in __d_add()
2666 if (unlikely(d_in_lookup(dentry))) { in __d_add()
2667 dir = dentry->d_parent->d_inode; in __d_add()
2669 __d_lookup_done(dentry); in __d_add()
2673 hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry); in __d_add()
2674 raw_write_seqcount_begin(&dentry->d_seq); in __d_add()
2675 __d_set_inode_and_type(dentry, inode, add_flags); in __d_add()
2676 raw_write_seqcount_end(&dentry->d_seq); in __d_add()
2677 fsnotify_update_flags(dentry); in __d_add()
2679 __d_rehash(dentry); in __d_add()
2682 spin_unlock(&dentry->d_lock); in __d_add()
2696 void d_add(struct dentry *entry, struct inode *inode) in d_add()
2717 struct dentry *d_exact_alias(struct dentry *entry, struct inode *inode) in d_exact_alias()
2719 struct dentry *alias; in d_exact_alias()
2752 static void swap_names(struct dentry *dentry, struct dentry *target) in swap_names() argument
2755 if (unlikely(dname_external(dentry))) { in swap_names()
2759 swap(target->d_name.name, dentry->d_name.name); in swap_names()
2765 memcpy(target->d_iname, dentry->d_name.name, in swap_names()
2766 dentry->d_name.len + 1); in swap_names()
2767 dentry->d_name.name = target->d_name.name; in swap_names()
2771 if (unlikely(dname_external(dentry))) { in swap_names()
2776 memcpy(dentry->d_iname, target->d_name.name, in swap_names()
2778 target->d_name.name = dentry->d_name.name; in swap_names()
2779 dentry->d_name.name = dentry->d_iname; in swap_names()
2787 swap(((long *) &dentry->d_iname)[i], in swap_names()
2792 swap(dentry->d_name.hash_len, target->d_name.hash_len); in swap_names()
2795 static void copy_name(struct dentry *dentry, struct dentry *target) in copy_name() argument
2798 if (unlikely(dname_external(dentry))) in copy_name()
2799 old_name = external_name(dentry); in copy_name()
2802 dentry->d_name = target->d_name; in copy_name()
2804 memcpy(dentry->d_iname, target->d_name.name, in copy_name()
2806 dentry->d_name.name = dentry->d_iname; in copy_name()
2807 dentry->d_name.hash_len = target->d_name.hash_len; in copy_name()
2824 static void __d_move(struct dentry *dentry, struct dentry *target, in __d_move() argument
2827 struct dentry *old_parent, *p; in __d_move()
2831 WARN_ON(!dentry->d_inode); in __d_move()
2832 if (WARN_ON(dentry == target)) in __d_move()
2835 BUG_ON(d_ancestor(target, dentry)); in __d_move()
2836 old_parent = dentry->d_parent; in __d_move()
2838 if (IS_ROOT(dentry)) { in __d_move()
2846 BUG_ON(p == dentry); in __d_move()
2852 spin_lock_nested(&dentry->d_lock, 2); in __d_move()
2861 write_seqcount_begin(&dentry->d_seq); in __d_move()
2865 if (!d_unhashed(dentry)) in __d_move()
2866 ___d_drop(dentry); in __d_move()
2871 dentry->d_parent = target->d_parent; in __d_move()
2873 copy_name(dentry, target); in __d_move()
2875 dentry->d_parent->d_lockref.count++; in __d_move()
2876 if (dentry != old_parent) /* wasn't IS_ROOT */ in __d_move()
2880 swap_names(dentry, target); in __d_move()
2885 list_move(&dentry->d_child, &dentry->d_parent->d_subdirs); in __d_move()
2886 __d_rehash(dentry); in __d_move()
2887 fsnotify_update_flags(dentry); in __d_move()
2888 fscrypt_handle_d_move(dentry); in __d_move()
2891 write_seqcount_end(&dentry->d_seq); in __d_move()
2896 if (dentry->d_parent != old_parent) in __d_move()
2897 spin_unlock(&dentry->d_parent->d_lock); in __d_move()
2898 if (dentry != old_parent) in __d_move()
2901 spin_unlock(&dentry->d_lock); in __d_move()
2913 void d_move(struct dentry *dentry, struct dentry *target) in d_move() argument
2916 __d_move(dentry, target, false); in d_move()
2926 void d_exchange(struct dentry *dentry1, struct dentry *dentry2) in d_exchange()
2948 struct dentry *d_ancestor(struct dentry *p1, struct dentry *p2) in d_ancestor()
2950 struct dentry *p; in d_ancestor()
2969 struct dentry *dentry, struct dentry *alias) in __d_unalias() argument
2976 if (alias->d_parent == dentry->d_parent) in __d_unalias()
2980 if (!mutex_trylock(&dentry->d_sb->s_vfs_rename_mutex)) in __d_unalias()
2982 m1 = &dentry->d_sb->s_vfs_rename_mutex; in __d_unalias()
2987 __d_move(alias, dentry, false); in __d_unalias()
3020 struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) in d_splice_alias() argument
3025 BUG_ON(!d_unhashed(dentry)); in d_splice_alias()
3030 security_d_instantiate(dentry, inode); in d_splice_alias()
3033 struct dentry *new = __d_find_any_alias(inode); in d_splice_alias()
3038 if (unlikely(d_ancestor(new, dentry))) { in d_splice_alias()
3045 dentry->d_name.name, in d_splice_alias()
3049 struct dentry *old_parent = dget(new->d_parent); in d_splice_alias()
3050 int err = __d_unalias(inode, dentry, new); in d_splice_alias()
3058 __d_move(new, dentry, false); in d_splice_alias()
3066 __d_add(dentry, inode); in d_splice_alias()
3087 bool is_subdir(struct dentry *new_dentry, struct dentry *old_dentry) in is_subdir()
3114 static enum d_walk_ret d_genocide_kill(void *data, struct dentry *dentry) in d_genocide_kill() argument
3116 struct dentry *root = data; in d_genocide_kill()
3117 if (dentry != root) { in d_genocide_kill()
3118 if (d_unhashed(dentry) || !dentry->d_inode) in d_genocide_kill()
3121 if (!(dentry->d_flags & DCACHE_GENOCIDE)) { in d_genocide_kill()
3122 dentry->d_flags |= DCACHE_GENOCIDE; in d_genocide_kill()
3123 dentry->d_lockref.count--; in d_genocide_kill()
3129 void d_genocide(struct dentry *parent) in d_genocide()
3136 void d_tmpfile(struct dentry *dentry, struct inode *inode) in d_tmpfile() argument
3139 BUG_ON(dentry->d_name.name != dentry->d_iname || in d_tmpfile()
3140 !hlist_unhashed(&dentry->d_u.d_alias) || in d_tmpfile()
3141 !d_unlinked(dentry)); in d_tmpfile()
3142 spin_lock(&dentry->d_parent->d_lock); in d_tmpfile()
3143 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); in d_tmpfile()
3144 dentry->d_name.len = sprintf(dentry->d_iname, "#%llu", in d_tmpfile()
3146 spin_unlock(&dentry->d_lock); in d_tmpfile()
3147 spin_unlock(&dentry->d_parent->d_lock); in d_tmpfile()
3148 d_instantiate(dentry, inode); in d_tmpfile()
3190 dentry_cache = KMEM_CACHE_USERCOPY(dentry, in dcache_init()