aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/user.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/user.c')
-rw-r--r--kernel/user.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/kernel/user.c b/kernel/user.c
index e080ba863ae3..add57c7e4c07 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -55,21 +55,22 @@ struct user_struct root_user = {
55/* 55/*
56 * These routines must be called with the uidhash spinlock held! 56 * These routines must be called with the uidhash spinlock held!
57 */ 57 */
58static inline void uid_hash_insert(struct user_struct *up, struct list_head *hashent) 58static inline void uid_hash_insert(struct user_struct *up, struct hlist_head *hashent)
59{ 59{
60 list_add(&up->uidhash_list, hashent); 60 hlist_add_head(&up->uidhash_node, hashent);
61} 61}
62 62
63static inline void uid_hash_remove(struct user_struct *up) 63static inline void uid_hash_remove(struct user_struct *up)
64{ 64{
65 list_del(&up->uidhash_list); 65 hlist_del(&up->uidhash_node);
66} 66}
67 67
68static inline struct user_struct *uid_hash_find(uid_t uid, struct list_head *hashent) 68static inline struct user_struct *uid_hash_find(uid_t uid, struct hlist_head *hashent)
69{ 69{
70 struct user_struct *user; 70 struct user_struct *user;
71 struct hlist_node *h;
71 72
72 list_for_each_entry(user, hashent, uidhash_list) { 73 hlist_for_each_entry(user, h, hashent, uidhash_node) {
73 if(user->uid == uid) { 74 if(user->uid == uid) {
74 atomic_inc(&user->__count); 75 atomic_inc(&user->__count);
75 return user; 76 return user;
@@ -118,7 +119,7 @@ void free_uid(struct user_struct *up)
118 119
119struct user_struct * alloc_uid(struct user_namespace *ns, uid_t uid) 120struct user_struct * alloc_uid(struct user_namespace *ns, uid_t uid)
120{ 121{
121 struct list_head *hashent = uidhashentry(ns, uid); 122 struct hlist_head *hashent = uidhashentry(ns, uid);
122 struct user_struct *up; 123 struct user_struct *up;
123 124
124 spin_lock_irq(&uidhash_lock); 125 spin_lock_irq(&uidhash_lock);
@@ -207,7 +208,7 @@ static int __init uid_cache_init(void)
207 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); 208 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
208 209
209 for(n = 0; n < UIDHASH_SZ; ++n) 210 for(n = 0; n < UIDHASH_SZ; ++n)
210 INIT_LIST_HEAD(init_user_ns.uidhash_table + n); 211 INIT_HLIST_HEAD(init_user_ns.uidhash_table + n);
211 212
212 /* Insert the root user immediately (init already runs as root) */ 213 /* Insert the root user immediately (init already runs as root) */
213 spin_lock_irq(&uidhash_lock); 214 spin_lock_irq(&uidhash_lock);