linux/include
Serge E. Hallyn e885dcde75 cgroup_clone: use pid of newly created task for new cgroup
cgroup_clone creates a new cgroup with the pid of the task.  This works
correctly for unshare, but for clone cgroup_clone is called from
copy_namespaces inside copy_process, which happens before the new pid is
created.  As a result, the new cgroup was created with current's pid.
This patch:

	1. Moves the call inside copy_process to after the new pid
	   is created
	2. Passes the struct pid into ns_cgroup_clone (as it is not
	   yet attached to the task)
	3. Passes a name from ns_cgroup_clone() into cgroup_clone()
	   so as to keep cgroup_clone() itself simpler
	4. Uses pid_vnr() to get the process id value, so that the
	   pid used to name the new cgroup is always the pid as it
	   would be known to the task which did the cloning or
	   unsharing.  I think that is the most intuitive thing to
	   do.  This way, task t1 does clone(CLONE_NEWPID) to get
	   t2, which does clone(CLONE_NEWPID) to get t3, then the
	   cgroup for t3 will be named for the pid by which t2 knows
	   t3.

(Thanks to Dan Smith for finding the main bug)

Changelog:
	June 11: Incorporate Paul Menage's feedback:  don't pass
	         NULL to ns_cgroup_clone from unshare, and reduce
		 patch size by using 'nodename' in cgroup_clone.
	June 10: Original version

[akpm@linux-foundation.org: build fix]
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Serge Hallyn <serge@us.ibm.com>
Acked-by: Paul Menage <menage@google.com>
Tested-by: Dan Smith <danms@us.ibm.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-25 10:53:37 -07:00
..
acpi Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 2008-07-16 17:25:46 -07:00
asm-alpha clean up duplicated alloc/free_thread_info 2008-07-25 10:53:28 -07:00
asm-arm clean up duplicated alloc/free_thread_info 2008-07-25 10:53:28 -07:00
asm-avr32 clean up duplicated alloc/free_thread_info 2008-07-25 10:53:28 -07:00
asm-blackfin clean up duplicated alloc/free_thread_info 2008-07-25 10:53:28 -07:00
asm-cris clean up duplicated alloc/free_thread_info 2008-07-25 10:53:28 -07:00
asm-frv clean up duplicated alloc/free_thread_info 2008-07-25 10:53:28 -07:00
asm-generic gpiolib: allow user-selection 2008-07-25 10:53:30 -07:00
asm-h8300 clean up duplicated alloc/free_thread_info 2008-07-25 10:53:28 -07:00
asm-ia64 clean up duplicated alloc/free_thread_info 2008-07-25 10:53:28 -07:00
asm-m32r clean up duplicated alloc/free_thread_info 2008-07-25 10:53:28 -07:00
asm-m68k clean up duplicated alloc/free_thread_info 2008-07-25 10:53:28 -07:00
asm-m68knommu clean up duplicated alloc/free_thread_info 2008-07-25 10:53:28 -07:00
asm-mips gpiolib: allow user-selection 2008-07-25 10:53:30 -07:00
asm-mn10300 clean up duplicated alloc/free_thread_info 2008-07-25 10:53:28 -07:00
asm-parisc clean up duplicated alloc/free_thread_info 2008-07-25 10:53:28 -07:00
asm-powerpc gpiolib: allow user-selection 2008-07-25 10:53:30 -07:00
asm-s390 clean up duplicated alloc/free_thread_info 2008-07-25 10:53:28 -07:00
asm-sh clean up duplicated alloc/free_thread_info 2008-07-25 10:53:28 -07:00
asm-sparc clean up duplicated alloc/free_thread_info 2008-07-25 10:53:28 -07:00
asm-sparc64 Remove asm/semaphore.h 2008-07-24 08:31:12 -04:00
asm-um clean up duplicated alloc/free_thread_info 2008-07-25 10:53:28 -07:00
asm-v850 remove the v850 port 2008-07-24 10:47:24 -07:00
asm-x86 gpiolib: allow user-selection 2008-07-25 10:53:30 -07:00
asm-xtensa clean up duplicated alloc/free_thread_info 2008-07-25 10:53:28 -07:00
crypto
drm drm/radeon: fixup issue with radeon and PAT support. 2008-07-15 15:48:05 +10:00
keys
linux cgroup_clone: use pid of newly created task for new cgroup 2008-07-25 10:53:37 -07:00
math-emu
media V4L/DVB (8395): saa7134: Fix Kbuild dependency of ir-kbd-i2c 2008-07-20 07:29:03 -03:00
mtd
net include: use get/put_unaligned_* helpers 2008-07-25 10:53:26 -07:00
pcmcia
rdma RDMA/cma: Add RDMA_CM_EVENT_TIMEWAIT_EXIT event 2008-07-22 14:14:23 -07:00
rxrpc
scsi driver core: remove KOBJ_NAME_LEN define 2008-07-21 21:54:52 -07:00
sound
video neofb: drop the xtimings structure 2008-07-24 10:47:41 -07:00
xen xen: implement Xen-specific spinlocks 2008-07-16 11:15:53 +02:00
Kbuild