userns: Simplify the user and group mapping functions
commit3edf652fa16562fb57a5a4b996ba72e2d7cdc38b
authorEric W. Biederman <ebiederm@xmission.com>
Tue, 31 Oct 2017 21:27:29 +0000 (31 16:27 -0500)
committerEric W. Biederman <ebiederm@xmission.com>
Tue, 31 Oct 2017 22:23:12 +0000 (31 17:23 -0500)
treee4eeee3cab3552207c36eac2ff9ae94f5e1b6134
parent11a8b9270e16e36d5fb607ba4b60db2958b7c625
userns: Simplify the user and group mapping functions

Consolidate reading the number of extents and computing the return
value in the map_id_down, map_id_range_down and map_id_range.

This removal of one read of extents makes one smp_rmb unnecessary
and makes the code safe it is executed during the map write.  Reading
the number of extents twice and depending on the result being the same
is not safe, as it could be 0 the first time and > 5 the second time,
which would lead to misinterpreting the union fields.

The consolidation of the return value just removes a duplicate
caluculation which should make it easier to understand and maintain
the code.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
kernel/user_namespace.c