diff options
Diffstat (limited to 'include/linux/user_namespace.h')
-rw-r--r-- | include/linux/user_namespace.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h index b9bd2e6c73cc..4ce009324933 100644 --- a/include/linux/user_namespace.h +++ b/include/linux/user_namespace.h | |||
@@ -21,7 +21,7 @@ struct user_namespace { | |||
21 | struct uid_gid_map uid_map; | 21 | struct uid_gid_map uid_map; |
22 | struct uid_gid_map gid_map; | 22 | struct uid_gid_map gid_map; |
23 | struct uid_gid_map projid_map; | 23 | struct uid_gid_map projid_map; |
24 | struct kref kref; | 24 | atomic_t count; |
25 | struct user_namespace *parent; | 25 | struct user_namespace *parent; |
26 | kuid_t owner; | 26 | kuid_t owner; |
27 | kgid_t group; | 27 | kgid_t group; |
@@ -35,18 +35,18 @@ extern struct user_namespace init_user_ns; | |||
35 | static inline struct user_namespace *get_user_ns(struct user_namespace *ns) | 35 | static inline struct user_namespace *get_user_ns(struct user_namespace *ns) |
36 | { | 36 | { |
37 | if (ns) | 37 | if (ns) |
38 | kref_get(&ns->kref); | 38 | atomic_inc(&ns->count); |
39 | return ns; | 39 | return ns; |
40 | } | 40 | } |
41 | 41 | ||
42 | extern int create_user_ns(struct cred *new); | 42 | extern int create_user_ns(struct cred *new); |
43 | extern int unshare_userns(unsigned long unshare_flags, struct cred **new_cred); | 43 | extern int unshare_userns(unsigned long unshare_flags, struct cred **new_cred); |
44 | extern void free_user_ns(struct kref *kref); | 44 | extern void free_user_ns(struct user_namespace *ns); |
45 | 45 | ||
46 | static inline void put_user_ns(struct user_namespace *ns) | 46 | static inline void put_user_ns(struct user_namespace *ns) |
47 | { | 47 | { |
48 | if (ns) | 48 | if (ns && atomic_dec_and_test(&ns->count)) |
49 | kref_put(&ns->kref, free_user_ns); | 49 | free_user_ns(ns); |
50 | } | 50 | } |
51 | 51 | ||
52 | struct seq_operations; | 52 | struct seq_operations; |