]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
cgroup: restructure locking and error handling in cgroup_mount()
authorTejun Heo <tj@kernel.org>
Tue, 11 Feb 2014 16:52:48 +0000 (11:52 -0500)
committerTejun Heo <tj@kernel.org>
Tue, 11 Feb 2014 16:52:48 +0000 (11:52 -0500)
commit8e30e2b8ba0ee58aa0f442d0b4a3cac1a4f2efb5
treeb1a796507f905ef496f7d6b63e4f2451e756ea5c
parent4ac0601744eb86e982fbdadde35f1945f7ce5882
cgroup: restructure locking and error handling in cgroup_mount()

cgroup is scheduled to be converted to kernfs.  After conversion,
cgroup_mount() won't use the sget() machinery for finding out existing
super_blocks but instead would do that directly.  It'll search the
existing cgroupfs_roots for a matching one and create a new one iff a
match doesn't exist.  To ease such conversion, this patch restructures
locking and error handling of the function.

cgroup_tree_mutex and cgroup_mutex are grabbed from the get-go and
held until return.  For now, due to the way vfs locks nest outside
cgroup mutexes, the two cgroup mutexes are temporarily dropped across
sget() and inode mutex locking, which looks quite ridiculous; however,
these will be removed through kernfs conversion and structuring the
code this way makes the conversion less painful.

The error goto labels are consolidated to two.  This looks unwieldy
now but the next patch will factor out creation of new root into a
separate function with accompanying error handling and it'll look a
lot better.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
kernel/cgroup.c