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 (dentry->d_lockref.count > 1) { in fast_dput()
763 dentry->d_lockref.count--; in fast_dput()
764 spin_unlock(&dentry->d_lock); 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()
818 if (dentry->d_lockref.count) { in fast_dput()
819 spin_unlock(&dentry->d_lock); in fast_dput()
828 dentry->d_lockref.count = 1; in fast_dput()
859 void dput(struct dentry *dentry) in dput() argument
861 while (dentry) { in dput()
865 if (likely(fast_dput(dentry))) { in dput()
873 if (likely(retain_dentry(dentry))) { in dput()
874 spin_unlock(&dentry->d_lock); in dput()
878 dentry = dentry_kill(dentry); in dput()
883 static void __dput_to_list(struct dentry *dentry, struct list_head *list) in __dput_to_list() argument
884 __must_hold(&dentry->d_lock) in __dput_to_list()
886 if (dentry->d_flags & DCACHE_SHRINK_LIST) { in __dput_to_list()
888 --dentry->d_lockref.count; in __dput_to_list()
890 if (dentry->d_flags & DCACHE_LRU_LIST) in __dput_to_list()
891 d_lru_del(dentry); in __dput_to_list()
892 if (!--dentry->d_lockref.count) in __dput_to_list()
893 d_shrink_add(dentry, list); in __dput_to_list()
897 void dput_to_list(struct dentry *dentry, struct list_head *list) in dput_to_list() argument
900 if (likely(fast_dput(dentry))) { in dput_to_list()
905 if (!retain_dentry(dentry)) in dput_to_list()
906 __dput_to_list(dentry, list); in dput_to_list()
907 spin_unlock(&dentry->d_lock); in dput_to_list()
911 static inline void __dget_dlock(struct dentry *dentry) in __dget_dlock() argument
913 dentry->d_lockref.count++; in __dget_dlock()
916 static inline void __dget(struct dentry *dentry) in __dget() argument
918 lockref_get(&dentry->d_lockref); in __dget()
921 struct dentry *dget_parent(struct dentry *dentry) in dget_parent() argument
924 struct dentry *ret; in dget_parent()
932 seq = raw_seqcount_begin(&dentry->d_seq); in dget_parent()
933 ret = READ_ONCE(dentry->d_parent); in dget_parent()
937 if (!read_seqcount_retry(&dentry->d_seq, seq)) in dget_parent()
948 ret = dentry->d_parent; in dget_parent()
950 if (unlikely(ret != dentry->d_parent)) { in dget_parent()
963 static struct dentry * __d_find_any_alias(struct inode *inode) in __d_find_any_alias()
965 struct dentry *alias; in __d_find_any_alias()
969 alias = hlist_entry(inode->i_dentry.first, struct dentry, d_u.d_alias); in __d_find_any_alias()
981 struct dentry *d_find_any_alias(struct inode *inode) in d_find_any_alias()
983 struct dentry *de; in d_find_any_alias()
1006 static struct dentry *__d_find_alias(struct inode *inode) in __d_find_alias()
1008 struct dentry *alias; in __d_find_alias()
1025 struct dentry *d_find_alias(struct inode *inode) in d_find_alias()
1027 struct dentry *de = NULL; in d_find_alias()
1044 struct dentry *dentry; in d_prune_aliases() local
1047 hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) { in d_prune_aliases()
1048 spin_lock(&dentry->d_lock); in d_prune_aliases()
1049 if (!dentry->d_lockref.count) { in d_prune_aliases()
1050 struct dentry *parent = lock_parent(dentry); in d_prune_aliases()
1051 if (likely(!dentry->d_lockref.count)) { in d_prune_aliases()
1052 __dentry_kill(dentry); in d_prune_aliases()
1059 spin_unlock(&dentry->d_lock); in d_prune_aliases()
1076 static bool shrink_lock_dentry(struct dentry *dentry) in shrink_lock_dentry() argument
1079 struct dentry *parent; in shrink_lock_dentry()
1081 if (dentry->d_lockref.count) in shrink_lock_dentry()
1084 inode = dentry->d_inode; in shrink_lock_dentry()
1086 spin_unlock(&dentry->d_lock); in shrink_lock_dentry()
1088 spin_lock(&dentry->d_lock); in shrink_lock_dentry()
1089 if (unlikely(dentry->d_lockref.count)) in shrink_lock_dentry()
1092 if (unlikely(inode != dentry->d_inode)) in shrink_lock_dentry()
1096 parent = dentry->d_parent; in shrink_lock_dentry()
1097 if (IS_ROOT(dentry) || likely(spin_trylock(&parent->d_lock))) in shrink_lock_dentry()
1100 spin_unlock(&dentry->d_lock); in shrink_lock_dentry()
1102 if (unlikely(parent != dentry->d_parent)) { in shrink_lock_dentry()
1104 spin_lock(&dentry->d_lock); in shrink_lock_dentry()
1107 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); in shrink_lock_dentry()
1108 if (likely(!dentry->d_lockref.count)) in shrink_lock_dentry()
1120 struct dentry *dentry, *parent; in shrink_dentry_list() local
1122 dentry = list_entry(list->prev, struct dentry, d_lru); in shrink_dentry_list()
1123 spin_lock(&dentry->d_lock); in shrink_dentry_list()
1125 if (!shrink_lock_dentry(dentry)) { in shrink_dentry_list()
1128 d_shrink_del(dentry); in shrink_dentry_list()
1129 if (dentry->d_lockref.count < 0) in shrink_dentry_list()
1130 can_free = dentry->d_flags & DCACHE_MAY_FREE; in shrink_dentry_list()
1131 spin_unlock(&dentry->d_lock); in shrink_dentry_list()
1133 dentry_free(dentry); in shrink_dentry_list()
1137 d_shrink_del(dentry); in shrink_dentry_list()
1138 parent = dentry->d_parent; in shrink_dentry_list()
1139 if (parent != dentry) in shrink_dentry_list()
1141 __dentry_kill(dentry); in shrink_dentry_list()
1149 struct dentry *dentry = container_of(item, struct dentry, d_lru); in dentry_lru_isolate() local
1157 if (!spin_trylock(&dentry->d_lock)) in dentry_lru_isolate()
1165 if (dentry->d_lockref.count) { in dentry_lru_isolate()
1166 d_lru_isolate(lru, dentry); in dentry_lru_isolate()
1167 spin_unlock(&dentry->d_lock); in dentry_lru_isolate()
1171 if (dentry->d_flags & DCACHE_REFERENCED) { in dentry_lru_isolate()
1172 dentry->d_flags &= ~DCACHE_REFERENCED; in dentry_lru_isolate()
1173 spin_unlock(&dentry->d_lock); in dentry_lru_isolate()
1197 d_lru_shrink_move(lru, dentry, freeable); in dentry_lru_isolate()
1198 spin_unlock(&dentry->d_lock); in dentry_lru_isolate()
1230 struct dentry *dentry = container_of(item, struct dentry, d_lru); in dentry_lru_isolate_shrink() local
1237 if (!spin_trylock(&dentry->d_lock)) in dentry_lru_isolate_shrink()
1240 d_lru_shrink_move(lru, dentry, freeable); in dentry_lru_isolate_shrink()
1241 spin_unlock(&dentry->d_lock); in dentry_lru_isolate_shrink()
1288 static void d_walk(struct dentry *parent, void *data, in d_walk() argument
1289 enum d_walk_ret (*enter)(void *, struct dentry *)) in d_walk()
1291 struct dentry *this_parent; in d_walk()
1318 struct dentry *dentry = list_entry(tmp, struct dentry, d_child); in d_walk() local
1321 if (unlikely(dentry->d_flags & DCACHE_DENTRY_CURSOR)) in d_walk()
1324 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); in d_walk()
1326 ret = enter(data, dentry); in d_walk()
1331 spin_unlock(&dentry->d_lock); in d_walk()
1337 spin_unlock(&dentry->d_lock); in d_walk()
1341 if (!list_empty(&dentry->d_subdirs)) { in d_walk()
1343 spin_release(&dentry->d_lock.dep_map, _RET_IP_); in d_walk()
1344 this_parent = dentry; in d_walk()
1348 spin_unlock(&dentry->d_lock); in d_walk()
1356 struct dentry *child = this_parent; in d_walk()
1370 child = list_entry(next, struct dentry, d_child); in d_walk()
1399 static enum d_walk_ret path_check_mount(void *data, struct dentry *dentry) in path_check_mount() argument
1402 struct path path = { .mnt = info->mnt, .dentry = dentry }; in path_check_mount()
1404 if (likely(!d_mountpoint(dentry))) in path_check_mount()
1426 d_walk(parent->dentry, &data, path_check_mount); in path_has_submounts()
1441 int d_set_mounted(struct dentry *dentry) in d_set_mounted() argument
1443 struct dentry *p; in d_set_mounted()
1446 for (p = dentry->d_parent; !IS_ROOT(p); p = p->d_parent) { in d_set_mounted()
1455 spin_lock(&dentry->d_lock); in d_set_mounted()
1456 if (!d_unlinked(dentry)) { in d_set_mounted()
1458 if (!d_mountpoint(dentry)) { in d_set_mounted()
1459 dentry->d_flags |= DCACHE_MOUNTED; in d_set_mounted()
1463 spin_unlock(&dentry->d_lock); in d_set_mounted()
1485 struct dentry *start;
1488 struct dentry *victim;
1493 static enum d_walk_ret select_collect(void *_data, struct dentry *dentry) in select_collect() argument
1498 if (data->start == dentry) in select_collect()
1501 if (dentry->d_flags & DCACHE_SHRINK_LIST) { in select_collect()
1504 if (dentry->d_flags & DCACHE_LRU_LIST) in select_collect()
1505 d_lru_del(dentry); in select_collect()
1506 if (!dentry->d_lockref.count) { in select_collect()
1507 d_shrink_add(dentry, &data->dispose); in select_collect()
1522 static enum d_walk_ret select_collect2(void *_data, struct dentry *dentry) in select_collect2() argument
1527 if (data->start == dentry) in select_collect2()
1530 if (dentry->d_flags & DCACHE_SHRINK_LIST) { in select_collect2()
1531 if (!dentry->d_lockref.count) { in select_collect2()
1533 data->victim = dentry; in select_collect2()
1537 if (dentry->d_flags & DCACHE_LRU_LIST) in select_collect2()
1538 d_lru_del(dentry); in select_collect2()
1539 if (!dentry->d_lockref.count) in select_collect2()
1540 d_shrink_add(dentry, &data->dispose); in select_collect2()
1559 void shrink_dcache_parent(struct dentry *parent) in shrink_dcache_parent()
1578 struct dentry *parent; in shrink_dcache_parent()
1597 static enum d_walk_ret umount_check(void *_data, struct dentry *dentry) in umount_check() argument
1600 if (!list_empty(&dentry->d_subdirs)) in umount_check()
1604 if (dentry == _data && dentry->d_lockref.count == 1) in umount_check()
1609 dentry, in umount_check()
1610 dentry->d_inode ? in umount_check()
1611 dentry->d_inode->i_ino : 0UL, in umount_check()
1612 dentry, in umount_check()
1613 dentry->d_lockref.count, in umount_check()
1614 dentry->d_sb->s_type->name, in umount_check()
1615 dentry->d_sb->s_id); in umount_check()
1620 static void do_one_tree(struct dentry *dentry) in do_one_tree() argument
1622 shrink_dcache_parent(dentry); in do_one_tree()
1623 d_walk(dentry, dentry, umount_check); in do_one_tree()
1624 d_drop(dentry); in do_one_tree()
1625 dput(dentry); in do_one_tree()
1633 struct dentry *dentry; in shrink_dcache_for_umount() local
1637 dentry = sb->s_root; in shrink_dcache_for_umount()
1639 do_one_tree(dentry); in shrink_dcache_for_umount()
1642 dentry = dget(hlist_bl_entry(hlist_bl_first(&sb->s_roots), struct dentry, d_hash)); in shrink_dcache_for_umount()
1643 do_one_tree(dentry); in shrink_dcache_for_umount()
1647 static enum d_walk_ret find_submount(void *_data, struct dentry *dentry) in find_submount() argument
1649 struct dentry **victim = _data; in find_submount()
1650 if (d_mountpoint(dentry)) { in find_submount()
1651 __dget_dlock(dentry); in find_submount()
1652 *victim = dentry; in find_submount()
1662 void d_invalidate(struct dentry *dentry) in d_invalidate() argument
1665 spin_lock(&dentry->d_lock); in d_invalidate()
1666 if (d_unhashed(dentry)) { in d_invalidate()
1667 spin_unlock(&dentry->d_lock); in d_invalidate()
1670 __d_drop(dentry); in d_invalidate()
1671 spin_unlock(&dentry->d_lock); in d_invalidate()
1674 if (!dentry->d_inode) in d_invalidate()
1677 shrink_dcache_parent(dentry); in d_invalidate()
1679 struct dentry *victim = NULL; in d_invalidate()
1680 d_walk(dentry, &victim, find_submount); in d_invalidate()
1683 shrink_dcache_parent(dentry); in d_invalidate()
1703 static struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) in __d_alloc()
1705 struct dentry *dentry; in __d_alloc() local
1709 dentry = kmem_cache_alloc(dentry_cache, GFP_KERNEL); in __d_alloc()
1710 if (!dentry) in __d_alloc()
1719 dentry->d_iname[DNAME_INLINE_LEN-1] = 0; in __d_alloc()
1722 dname = dentry->d_iname; in __d_alloc()
1729 kmem_cache_free(dentry_cache, dentry); in __d_alloc()
1735 dname = dentry->d_iname; in __d_alloc()
1738 dentry->d_name.len = name->len; in __d_alloc()
1739 dentry->d_name.hash = name->hash; in __d_alloc()
1744 smp_store_release(&dentry->d_name.name, dname); /* ^^^ */ in __d_alloc()
1746 dentry->d_lockref.count = 1; in __d_alloc()
1747 dentry->d_flags = 0; in __d_alloc()
1748 spin_lock_init(&dentry->d_lock); in __d_alloc()
1749 seqcount_spinlock_init(&dentry->d_seq, &dentry->d_lock); in __d_alloc()
1750 dentry->d_inode = NULL; in __d_alloc()
1751 dentry->d_parent = dentry; in __d_alloc()
1752 dentry->d_sb = sb; in __d_alloc()
1753 dentry->d_op = NULL; in __d_alloc()
1754 dentry->d_fsdata = NULL; in __d_alloc()
1755 INIT_HLIST_BL_NODE(&dentry->d_hash); in __d_alloc()
1756 INIT_LIST_HEAD(&dentry->d_lru); in __d_alloc()
1757 INIT_LIST_HEAD(&dentry->d_subdirs); in __d_alloc()
1758 INIT_HLIST_NODE(&dentry->d_u.d_alias); in __d_alloc()
1759 INIT_LIST_HEAD(&dentry->d_child); in __d_alloc()
1760 d_set_d_op(dentry, dentry->d_sb->s_d_op); in __d_alloc()
1762 if (dentry->d_op && dentry->d_op->d_init) { in __d_alloc()
1763 err = dentry->d_op->d_init(dentry); in __d_alloc()
1765 if (dname_external(dentry)) in __d_alloc()
1766 kfree(external_name(dentry)); in __d_alloc()
1767 kmem_cache_free(dentry_cache, dentry); in __d_alloc()
1774 return dentry; in __d_alloc()
1786 struct dentry *d_alloc(struct dentry * parent, const struct qstr *name) in d_alloc()
1788 struct dentry *dentry = __d_alloc(parent->d_sb, name); in d_alloc() local
1789 if (!dentry) in d_alloc()
1797 dentry->d_parent = parent; in d_alloc()
1798 list_add(&dentry->d_child, &parent->d_subdirs); in d_alloc()
1801 return dentry; in d_alloc()
1805 struct dentry *d_alloc_anon(struct super_block *sb) in d_alloc_anon()
1811 struct dentry *d_alloc_cursor(struct dentry * parent) in d_alloc_cursor()
1813 struct dentry *dentry = d_alloc_anon(parent->d_sb); in d_alloc_cursor() local
1814 if (dentry) { in d_alloc_cursor()
1815 dentry->d_flags |= DCACHE_DENTRY_CURSOR; in d_alloc_cursor()
1816 dentry->d_parent = dget(parent); in d_alloc_cursor()
1818 return dentry; in d_alloc_cursor()
1836 struct dentry *d_alloc_pseudo(struct super_block *sb, const struct qstr *name) in d_alloc_pseudo()
1838 struct dentry *dentry = __d_alloc(sb, name); in d_alloc_pseudo() local
1839 if (likely(dentry)) in d_alloc_pseudo()
1840 dentry->d_flags |= DCACHE_NORCU; in d_alloc_pseudo()
1841 return dentry; in d_alloc_pseudo()
1844 struct dentry *d_alloc_name(struct dentry *parent, const char *name) in d_alloc_name()
1854 void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op) in d_set_d_op() argument
1856 WARN_ON_ONCE(dentry->d_op); in d_set_d_op()
1857 WARN_ON_ONCE(dentry->d_flags & (DCACHE_OP_HASH | in d_set_d_op()
1863 dentry->d_op = op; in d_set_d_op()
1867 dentry->d_flags |= DCACHE_OP_HASH; in d_set_d_op()
1869 dentry->d_flags |= DCACHE_OP_COMPARE; in d_set_d_op()
1871 dentry->d_flags |= DCACHE_OP_REVALIDATE; in d_set_d_op()
1873 dentry->d_flags |= DCACHE_OP_WEAK_REVALIDATE; in d_set_d_op()
1875 dentry->d_flags |= DCACHE_OP_DELETE; in d_set_d_op()
1877 dentry->d_flags |= DCACHE_OP_PRUNE; in d_set_d_op()
1879 dentry->d_flags |= DCACHE_OP_REAL; in d_set_d_op()
1892 void d_set_fallthru(struct dentry *dentry) in d_set_fallthru() argument
1894 spin_lock(&dentry->d_lock); in d_set_fallthru()
1895 dentry->d_flags |= DCACHE_FALLTHRU; in d_set_fallthru()
1896 spin_unlock(&dentry->d_lock); in d_set_fallthru()
1935 static void __d_instantiate(struct dentry *dentry, struct inode *inode) in __d_instantiate() argument
1938 WARN_ON(d_in_lookup(dentry)); in __d_instantiate()
1940 spin_lock(&dentry->d_lock); in __d_instantiate()
1944 if (dentry->d_flags & DCACHE_LRU_LIST) in __d_instantiate()
1946 hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry); in __d_instantiate()
1947 raw_write_seqcount_begin(&dentry->d_seq); in __d_instantiate()
1948 __d_set_inode_and_type(dentry, inode, add_flags); in __d_instantiate()
1949 raw_write_seqcount_end(&dentry->d_seq); in __d_instantiate()
1950 fsnotify_update_flags(dentry); in __d_instantiate()
1951 spin_unlock(&dentry->d_lock); in __d_instantiate()
1969 void d_instantiate(struct dentry *entry, struct inode * inode) in d_instantiate()
1987 void d_instantiate_new(struct dentry *entry, struct inode *inode) in d_instantiate_new()
2003 struct dentry *d_make_root(struct inode *root_inode) in d_make_root()
2005 struct dentry *res = NULL; in d_make_root()
2018 static struct dentry *__d_instantiate_anon(struct dentry *dentry, in __d_instantiate_anon() argument
2022 struct dentry *res; in __d_instantiate_anon()
2025 security_d_instantiate(dentry, inode); in __d_instantiate_anon()
2030 dput(dentry); in __d_instantiate_anon()
2040 spin_lock(&dentry->d_lock); in __d_instantiate_anon()
2041 __d_set_inode_and_type(dentry, inode, add_flags); in __d_instantiate_anon()
2042 hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry); in __d_instantiate_anon()
2044 hlist_bl_lock(&dentry->d_sb->s_roots); in __d_instantiate_anon()
2045 hlist_bl_add_head(&dentry->d_hash, &dentry->d_sb->s_roots); in __d_instantiate_anon()
2046 hlist_bl_unlock(&dentry->d_sb->s_roots); in __d_instantiate_anon()
2048 spin_unlock(&dentry->d_lock); in __d_instantiate_anon()
2051 return dentry; in __d_instantiate_anon()
2058 struct dentry *d_instantiate_anon(struct dentry *dentry, struct inode *inode) in d_instantiate_anon() argument
2060 return __d_instantiate_anon(dentry, inode, true); in d_instantiate_anon()
2064 static struct dentry *__d_obtain_alias(struct inode *inode, bool disconnected) in __d_obtain_alias()
2066 struct dentry *tmp; in __d_obtain_alias()
2067 struct dentry *res; in __d_obtain_alias()
2109 struct dentry *d_obtain_alias(struct inode *inode) in d_obtain_alias()
2130 struct dentry *d_obtain_root(struct inode *inode) in d_obtain_root()
2152 struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode, in d_add_ci() argument
2155 struct dentry *found, *res; in d_add_ci()
2161 found = d_hash_and_lookup(dentry->d_parent, name); in d_add_ci()
2166 if (d_in_lookup(dentry)) { in d_add_ci()
2167 found = d_alloc_parallel(dentry->d_parent, name, in d_add_ci()
2168 dentry->d_wait); in d_add_ci()
2174 found = d_alloc(dentry->d_parent, name); in d_add_ci()
2190 static inline bool d_same_name(const struct dentry *dentry, in d_same_name() argument
2191 const struct dentry *parent, in d_same_name()
2195 if (dentry->d_name.len != name->len) in d_same_name()
2197 return dentry_cmp(dentry, name->name, name->len) == 0; in d_same_name()
2199 return parent->d_op->d_compare(dentry, in d_same_name()
2200 dentry->d_name.len, dentry->d_name.name, in d_same_name()
2233 struct dentry *__d_lookup_rcu(const struct dentry *parent, in __d_lookup_rcu()
2241 struct dentry *dentry; in __d_lookup_rcu() local
2263 hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) { in __d_lookup_rcu()
2284 seq = raw_seqcount_begin(&dentry->d_seq); in __d_lookup_rcu()
2285 if (dentry->d_parent != parent) in __d_lookup_rcu()
2287 if (d_unhashed(dentry)) in __d_lookup_rcu()
2293 if (dentry->d_name.hash != hashlen_hash(hashlen)) in __d_lookup_rcu()
2295 tlen = dentry->d_name.len; in __d_lookup_rcu()
2296 tname = dentry->d_name.name; in __d_lookup_rcu()
2298 if (read_seqcount_retry(&dentry->d_seq, seq)) { in __d_lookup_rcu()
2302 if (parent->d_op->d_compare(dentry, in __d_lookup_rcu()
2306 if (dentry->d_name.hash_len != hashlen) in __d_lookup_rcu()
2308 if (dentry_cmp(dentry, str, hashlen_len(hashlen)) != 0) in __d_lookup_rcu()
2312 return dentry; in __d_lookup_rcu()
2328 struct dentry *d_lookup(const struct dentry *parent, const struct qstr *name) in d_lookup()
2330 struct dentry *dentry; in d_lookup() local
2335 dentry = __d_lookup(parent, name); in d_lookup()
2336 if (dentry) in d_lookup()
2339 return dentry; in d_lookup()
2358 struct dentry *__d_lookup(const struct dentry *parent, const struct qstr *name) in __d_lookup()
2363 struct dentry *found = NULL; in __d_lookup()
2364 struct dentry *dentry; in __d_lookup() local
2388 hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) { in __d_lookup()
2390 if (dentry->d_name.hash != hash) in __d_lookup()
2393 spin_lock(&dentry->d_lock); in __d_lookup()
2394 if (dentry->d_parent != parent) in __d_lookup()
2396 if (d_unhashed(dentry)) in __d_lookup()
2399 if (!d_same_name(dentry, parent, name)) in __d_lookup()
2402 dentry->d_lockref.count++; in __d_lookup()
2403 found = dentry; in __d_lookup()
2404 spin_unlock(&dentry->d_lock); in __d_lookup()
2407 spin_unlock(&dentry->d_lock); in __d_lookup()
2421 struct dentry *d_hash_and_lookup(struct dentry *dir, struct qstr *name) in d_hash_and_lookup()
2459 void d_delete(struct dentry * dentry) in d_delete() argument
2461 struct inode *inode = dentry->d_inode; in d_delete()
2464 spin_lock(&dentry->d_lock); in d_delete()
2468 if (dentry->d_lockref.count == 1) { in d_delete()
2469 dentry->d_flags &= ~DCACHE_CANT_MOUNT; in d_delete()
2470 dentry_unlink_inode(dentry); in d_delete()
2472 __d_drop(dentry); in d_delete()
2473 spin_unlock(&dentry->d_lock); in d_delete()
2479 static void __d_rehash(struct dentry *entry) in __d_rehash()
2495 void d_rehash(struct dentry * entry) in d_rehash()
2519 static void d_wait_lookup(struct dentry *dentry) in d_wait_lookup() argument
2521 if (d_in_lookup(dentry)) { in d_wait_lookup()
2523 add_wait_queue(dentry->d_wait, &wait); in d_wait_lookup()
2526 spin_unlock(&dentry->d_lock); in d_wait_lookup()
2528 spin_lock(&dentry->d_lock); in d_wait_lookup()
2529 } while (d_in_lookup(dentry)); in d_wait_lookup()
2533 struct dentry *d_alloc_parallel(struct dentry *parent, in d_alloc_parallel()
2540 struct dentry *new = d_alloc(parent, name); in d_alloc_parallel()
2541 struct dentry *dentry; in d_alloc_parallel() local
2551 dentry = __d_lookup_rcu(parent, name, &d_seq); in d_alloc_parallel()
2552 if (unlikely(dentry)) { in d_alloc_parallel()
2553 if (!lockref_get_not_dead(&dentry->d_lockref)) { in d_alloc_parallel()
2557 if (read_seqcount_retry(&dentry->d_seq, d_seq)) { in d_alloc_parallel()
2559 dput(dentry); in d_alloc_parallel()
2564 return dentry; in d_alloc_parallel()
2589 hlist_bl_for_each_entry(dentry, node, b, d_u.d_in_lookup_hash) { in d_alloc_parallel()
2590 if (dentry->d_name.hash != hash) in d_alloc_parallel()
2592 if (dentry->d_parent != parent) in d_alloc_parallel()
2594 if (!d_same_name(dentry, parent, name)) in d_alloc_parallel()
2598 if (!lockref_get_not_dead(&dentry->d_lockref)) { in d_alloc_parallel()
2608 spin_lock(&dentry->d_lock); in d_alloc_parallel()
2609 d_wait_lookup(dentry); in d_alloc_parallel()
2616 if (unlikely(dentry->d_name.hash != hash)) in d_alloc_parallel()
2618 if (unlikely(dentry->d_parent != parent)) in d_alloc_parallel()
2620 if (unlikely(d_unhashed(dentry))) in d_alloc_parallel()
2622 if (unlikely(!d_same_name(dentry, parent, name))) in d_alloc_parallel()
2625 spin_unlock(&dentry->d_lock); in d_alloc_parallel()
2627 return dentry; in d_alloc_parallel()
2637 spin_unlock(&dentry->d_lock); in d_alloc_parallel()
2638 dput(dentry); in d_alloc_parallel()
2643 void __d_lookup_done(struct dentry *dentry) in __d_lookup_done() argument
2645 struct hlist_bl_head *b = in_lookup_hash(dentry->d_parent, in __d_lookup_done()
2646 dentry->d_name.hash); in __d_lookup_done()
2648 dentry->d_flags &= ~DCACHE_PAR_LOOKUP; in __d_lookup_done()
2649 __hlist_bl_del(&dentry->d_u.d_in_lookup_hash); in __d_lookup_done()
2650 wake_up_all(dentry->d_wait); in __d_lookup_done()
2651 dentry->d_wait = NULL; in __d_lookup_done()
2653 INIT_HLIST_NODE(&dentry->d_u.d_alias); in __d_lookup_done()
2654 INIT_LIST_HEAD(&dentry->d_lru); in __d_lookup_done()
2660 static inline void __d_add(struct dentry *dentry, struct inode *inode) in __d_add() argument
2664 spin_lock(&dentry->d_lock); in __d_add()
2665 if (unlikely(d_in_lookup(dentry))) { in __d_add()
2666 dir = dentry->d_parent->d_inode; in __d_add()
2668 __d_lookup_done(dentry); in __d_add()
2672 hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry); in __d_add()
2673 raw_write_seqcount_begin(&dentry->d_seq); in __d_add()
2674 __d_set_inode_and_type(dentry, inode, add_flags); in __d_add()
2675 raw_write_seqcount_end(&dentry->d_seq); in __d_add()
2676 fsnotify_update_flags(dentry); in __d_add()
2678 __d_rehash(dentry); in __d_add()
2681 spin_unlock(&dentry->d_lock); in __d_add()
2695 void d_add(struct dentry *entry, struct inode *inode) in d_add()
2716 struct dentry *d_exact_alias(struct dentry *entry, struct inode *inode) in d_exact_alias()
2718 struct dentry *alias; in d_exact_alias()
2751 static void swap_names(struct dentry *dentry, struct dentry *target) in swap_names() argument
2754 if (unlikely(dname_external(dentry))) { in swap_names()
2758 swap(target->d_name.name, dentry->d_name.name); in swap_names()
2764 memcpy(target->d_iname, dentry->d_name.name, in swap_names()
2765 dentry->d_name.len + 1); in swap_names()
2766 dentry->d_name.name = target->d_name.name; in swap_names()
2770 if (unlikely(dname_external(dentry))) { in swap_names()
2775 memcpy(dentry->d_iname, target->d_name.name, in swap_names()
2777 target->d_name.name = dentry->d_name.name; in swap_names()
2778 dentry->d_name.name = dentry->d_iname; in swap_names()
2786 swap(((long *) &dentry->d_iname)[i], in swap_names()
2791 swap(dentry->d_name.hash_len, target->d_name.hash_len); in swap_names()
2794 static void copy_name(struct dentry *dentry, struct dentry *target) in copy_name() argument
2797 if (unlikely(dname_external(dentry))) in copy_name()
2798 old_name = external_name(dentry); in copy_name()
2801 dentry->d_name = target->d_name; in copy_name()
2803 memcpy(dentry->d_iname, target->d_name.name, in copy_name()
2805 dentry->d_name.name = dentry->d_iname; in copy_name()
2806 dentry->d_name.hash_len = target->d_name.hash_len; in copy_name()
2823 static void __d_move(struct dentry *dentry, struct dentry *target, in __d_move() argument
2826 struct dentry *old_parent, *p; in __d_move()
2830 WARN_ON(!dentry->d_inode); in __d_move()
2831 if (WARN_ON(dentry == target)) in __d_move()
2834 BUG_ON(d_ancestor(target, dentry)); in __d_move()
2835 old_parent = dentry->d_parent; in __d_move()
2837 if (IS_ROOT(dentry)) { in __d_move()
2845 BUG_ON(p == dentry); in __d_move()
2851 spin_lock_nested(&dentry->d_lock, 2); in __d_move()
2860 write_seqcount_begin(&dentry->d_seq); in __d_move()
2864 if (!d_unhashed(dentry)) in __d_move()
2865 ___d_drop(dentry); in __d_move()
2870 dentry->d_parent = target->d_parent; in __d_move()
2872 copy_name(dentry, target); in __d_move()
2874 dentry->d_parent->d_lockref.count++; in __d_move()
2875 if (dentry != old_parent) /* wasn't IS_ROOT */ in __d_move()
2879 swap_names(dentry, target); in __d_move()
2884 list_move(&dentry->d_child, &dentry->d_parent->d_subdirs); in __d_move()
2885 __d_rehash(dentry); in __d_move()
2886 fsnotify_update_flags(dentry); in __d_move()
2887 fscrypt_handle_d_move(dentry); in __d_move()
2890 write_seqcount_end(&dentry->d_seq); in __d_move()
2895 if (dentry->d_parent != old_parent) in __d_move()
2896 spin_unlock(&dentry->d_parent->d_lock); in __d_move()
2897 if (dentry != old_parent) in __d_move()
2900 spin_unlock(&dentry->d_lock); in __d_move()
2912 void d_move(struct dentry *dentry, struct dentry *target) in d_move() argument
2915 __d_move(dentry, target, false); in d_move()
2925 void d_exchange(struct dentry *dentry1, struct dentry *dentry2) in d_exchange()
2947 struct dentry *d_ancestor(struct dentry *p1, struct dentry *p2) in d_ancestor()
2949 struct dentry *p; in d_ancestor()
2968 struct dentry *dentry, struct dentry *alias) in __d_unalias() argument
2975 if (alias->d_parent == dentry->d_parent) in __d_unalias()
2979 if (!mutex_trylock(&dentry->d_sb->s_vfs_rename_mutex)) in __d_unalias()
2981 m1 = &dentry->d_sb->s_vfs_rename_mutex; in __d_unalias()
2986 __d_move(alias, dentry, false); in __d_unalias()
3019 struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) in d_splice_alias() argument
3024 BUG_ON(!d_unhashed(dentry)); in d_splice_alias()
3029 security_d_instantiate(dentry, inode); in d_splice_alias()
3032 struct dentry *new = __d_find_any_alias(inode); in d_splice_alias()
3037 if (unlikely(d_ancestor(new, dentry))) { in d_splice_alias()
3044 dentry->d_name.name, in d_splice_alias()
3048 struct dentry *old_parent = dget(new->d_parent); in d_splice_alias()
3049 int err = __d_unalias(inode, dentry, new); in d_splice_alias()
3057 __d_move(new, dentry, false); in d_splice_alias()
3065 __d_add(dentry, inode); in d_splice_alias()
3086 bool is_subdir(struct dentry *new_dentry, struct dentry *old_dentry) in is_subdir()
3113 static enum d_walk_ret d_genocide_kill(void *data, struct dentry *dentry) in d_genocide_kill() argument
3115 struct dentry *root = data; in d_genocide_kill()
3116 if (dentry != root) { in d_genocide_kill()
3117 if (d_unhashed(dentry) || !dentry->d_inode) in d_genocide_kill()
3120 if (!(dentry->d_flags & DCACHE_GENOCIDE)) { in d_genocide_kill()
3121 dentry->d_flags |= DCACHE_GENOCIDE; in d_genocide_kill()
3122 dentry->d_lockref.count--; in d_genocide_kill()
3128 void d_genocide(struct dentry *parent) in d_genocide()
3135 void d_tmpfile(struct dentry *dentry, struct inode *inode) in d_tmpfile() argument
3138 BUG_ON(dentry->d_name.name != dentry->d_iname || in d_tmpfile()
3139 !hlist_unhashed(&dentry->d_u.d_alias) || in d_tmpfile()
3140 !d_unlinked(dentry)); in d_tmpfile()
3141 spin_lock(&dentry->d_parent->d_lock); in d_tmpfile()
3142 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); in d_tmpfile()
3143 dentry->d_name.len = sprintf(dentry->d_iname, "#%llu", in d_tmpfile()
3145 spin_unlock(&dentry->d_lock); in d_tmpfile()
3146 spin_unlock(&dentry->d_parent->d_lock); in d_tmpfile()
3147 d_instantiate(dentry, inode); in d_tmpfile()
3189 dentry_cache = KMEM_CACHE_USERCOPY(dentry, in dcache_init()