userns: Use cred->user_ns instead of cred->user->user_ns
Optimize performance and prepare for the removal of the user_ns reference from user_struct. Remove the slow long walk through cred->user->user_ns and instead go straight to cred->user_ns. Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
This commit is contained in:
@@ -90,7 +90,7 @@ uid_t user_ns_map_uid(struct user_namespace *to, const struct cred *cred, uid_t
|
||||
{
|
||||
struct user_namespace *tmp;
|
||||
|
||||
if (likely(to == cred->user->user_ns))
|
||||
if (likely(to == cred->user_ns))
|
||||
return uid;
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ gid_t user_ns_map_gid(struct user_namespace *to, const struct cred *cred, gid_t
|
||||
{
|
||||
struct user_namespace *tmp;
|
||||
|
||||
if (likely(to == cred->user->user_ns))
|
||||
if (likely(to == cred->user_ns))
|
||||
return gid;
|
||||
|
||||
/* Is cred->user the creator of the target user_ns
|
||||
|
Reference in New Issue
Block a user