Re: [PATCH 5/5] cgroup: fix a race between cgroup_mount() and cgroup_kill_sb()

2014-06-27 Thread Tejun Heo
On Fri, Jun 27, 2014 at 02:32:33PM +0800, Li Zefan wrote: > > cgroup_mount() > > { > > mutex_lock(); > > lookup_cgroup_root(); > > if (root isn't killed yet) > > root->this_better_stay_alive++; > > mutex_unlock(); > > kernfs_mount(); > > } > > > > cgroup_kill_sb()

Re: [PATCH 5/5] cgroup: fix a race between cgroup_mount() and cgroup_kill_sb()

2014-06-27 Thread Li Zefan
On 2014/6/25 23:00, Tejun Heo wrote: > Hey, > > On Wed, Jun 25, 2014 at 09:56:31AM +0800, Li Zefan wrote: >>> Hmmm? Why does that matter? The only region in cgroup_mount() which >>> needs to be put inside such mutex would be root lookup, no? >> >> unfortunately that won't help. I think what you

Re: [PATCH 5/5] cgroup: fix a race between cgroup_mount() and cgroup_kill_sb()

2014-06-27 Thread Li Zefan
On 2014/6/25 23:00, Tejun Heo wrote: Hey, On Wed, Jun 25, 2014 at 09:56:31AM +0800, Li Zefan wrote: Hmmm? Why does that matter? The only region in cgroup_mount() which needs to be put inside such mutex would be root lookup, no? unfortunately that won't help. I think what you suggest is:

Re: [PATCH 5/5] cgroup: fix a race between cgroup_mount() and cgroup_kill_sb()

2014-06-27 Thread Tejun Heo
On Fri, Jun 27, 2014 at 02:32:33PM +0800, Li Zefan wrote: cgroup_mount() { mutex_lock(); lookup_cgroup_root(); if (root isn't killed yet) root-this_better_stay_alive++; mutex_unlock(); kernfs_mount(); } cgroup_kill_sb() { mutex_lock();

Re: [PATCH 5/5] cgroup: fix a race between cgroup_mount() and cgroup_kill_sb()

2014-06-25 Thread Tejun Heo
Hey, On Wed, Jun 25, 2014 at 09:56:31AM +0800, Li Zefan wrote: > > Hmmm? Why does that matter? The only region in cgroup_mount() which > > needs to be put inside such mutex would be root lookup, no? > > unfortunately that won't help. I think what you suggest is: > > cgroup_mount() > { >

Re: [PATCH 5/5] cgroup: fix a race between cgroup_mount() and cgroup_kill_sb()

2014-06-25 Thread Tejun Heo
Hey, On Wed, Jun 25, 2014 at 09:56:31AM +0800, Li Zefan wrote: Hmmm? Why does that matter? The only region in cgroup_mount() which needs to be put inside such mutex would be root lookup, no? unfortunately that won't help. I think what you suggest is: cgroup_mount() {

Re: [PATCH 5/5] cgroup: fix a race between cgroup_mount() and cgroup_kill_sb()

2014-06-24 Thread Li Zefan
On 2014/6/25 5:01, Tejun Heo wrote: > Hello, Li. > > On Tue, Jun 24, 2014 at 09:22:00AM +0800, Li Zefan wrote: >>> Ah, right. Gees, I'm really hating the fact that we have ->mount but >>> not ->umount. However, can't we make it a bit simpler by just >>> introducing a mutex protecting looking up

Re: [PATCH 5/5] cgroup: fix a race between cgroup_mount() and cgroup_kill_sb()

2014-06-24 Thread Tejun Heo
Hello, Li. On Tue, Jun 24, 2014 at 09:22:00AM +0800, Li Zefan wrote: > > Ah, right. Gees, I'm really hating the fact that we have ->mount but > > not ->umount. However, can't we make it a bit simpler by just > > introducing a mutex protecting looking up and refing up an existing > > root and a

Re: [PATCH 5/5] cgroup: fix a race between cgroup_mount() and cgroup_kill_sb()

2014-06-24 Thread Tejun Heo
Hello, Li. On Tue, Jun 24, 2014 at 09:22:00AM +0800, Li Zefan wrote: Ah, right. Gees, I'm really hating the fact that we have -mount but not -umount. However, can't we make it a bit simpler by just introducing a mutex protecting looking up and refing up an existing root and a sb going

Re: [PATCH 5/5] cgroup: fix a race between cgroup_mount() and cgroup_kill_sb()

2014-06-24 Thread Li Zefan
On 2014/6/25 5:01, Tejun Heo wrote: Hello, Li. On Tue, Jun 24, 2014 at 09:22:00AM +0800, Li Zefan wrote: Ah, right. Gees, I'm really hating the fact that we have -mount but not -umount. However, can't we make it a bit simpler by just introducing a mutex protecting looking up and refing up

Re: [PATCH 5/5] cgroup: fix a race between cgroup_mount() and cgroup_kill_sb()

2014-06-23 Thread Li Zefan
On 2014/6/21 3:35, Tejun Heo wrote: > Hello, Li. > > Sorry about the long delay. > > On Thu, Jun 12, 2014 at 02:33:05PM +0800, Li Zefan wrote: >> We've converted cgroup to kernfs so cgroup won't be intertwined with >> vfs objects and locking, but there are dark areas. >> >> Run two instances of

Re: [PATCH 5/5] cgroup: fix a race between cgroup_mount() and cgroup_kill_sb()

2014-06-23 Thread Li Zefan
On 2014/6/21 3:35, Tejun Heo wrote: Hello, Li. Sorry about the long delay. On Thu, Jun 12, 2014 at 02:33:05PM +0800, Li Zefan wrote: We've converted cgroup to kernfs so cgroup won't be intertwined with vfs objects and locking, but there are dark areas. Run two instances of this script

Re: [PATCH 5/5] cgroup: fix a race between cgroup_mount() and cgroup_kill_sb()

2014-06-20 Thread Tejun Heo
Hello, Li. Sorry about the long delay. On Thu, Jun 12, 2014 at 02:33:05PM +0800, Li Zefan wrote: > We've converted cgroup to kernfs so cgroup won't be intertwined with > vfs objects and locking, but there are dark areas. > > Run two instances of this script concurrently: > > for ((; ;)) >

Re: [PATCH 5/5] cgroup: fix a race between cgroup_mount() and cgroup_kill_sb()

2014-06-20 Thread Tejun Heo
Hello, Li. Sorry about the long delay. On Thu, Jun 12, 2014 at 02:33:05PM +0800, Li Zefan wrote: We've converted cgroup to kernfs so cgroup won't be intertwined with vfs objects and locking, but there are dark areas. Run two instances of this script concurrently: for ((; ;)) {

[PATCH 5/5] cgroup: fix a race between cgroup_mount() and cgroup_kill_sb()

2014-06-12 Thread Li Zefan
We've converted cgroup to kernfs so cgroup won't be intertwined with vfs objects and locking, but there are dark areas. Run two instances of this script concurrently: for ((; ;)) { mount -t cgroup -o cpuacct xxx /cgroup umount /cgroup } After a while, I saw two mount

[PATCH 5/5] cgroup: fix a race between cgroup_mount() and cgroup_kill_sb()

2014-06-12 Thread Li Zefan
We've converted cgroup to kernfs so cgroup won't be intertwined with vfs objects and locking, but there are dark areas. Run two instances of this script concurrently: for ((; ;)) { mount -t cgroup -o cpuacct xxx /cgroup umount /cgroup } After a while, I saw two mount