public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] blk-cgroup: Call cgroup_path only under cgroup lock
  2012-03-12 20:01 [PATCH] blk-cgroup: Call cgroup_path only under cgroup lock Sasha Levin
@ 2012-03-12 18:04 ` Tejun Heo
  2012-03-12 18:06   ` Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2012-03-12 18:04 UTC (permalink / raw)
  To: Sasha Levin; +Cc: axboe, linux-kernel, Vivek Goyal

Hello, Sasha.

On Mon, Mar 12, 2012 at 04:01:18PM -0400, Sasha Levin wrote:
> Since we can't keep rcu read lock during blkg_alloc(), we currently
> call cgroup_path() without any locks at all.
> 
> This patch adds cgroup locking before calling cgroup_path.
> 
> This also fixes a lockdep warning on boot.
> 
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>

Which branch is this against?  There's already pending stat update
patch from Vivek which fix this problem along with the percpu
allocation problem.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] blk-cgroup: Call cgroup_path only under cgroup lock
  2012-03-12 18:04 ` Tejun Heo
@ 2012-03-12 18:06   ` Sasha Levin
  2012-03-12 18:12     ` Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Sasha Levin @ 2012-03-12 18:06 UTC (permalink / raw)
  To: Tejun Heo; +Cc: axboe, linux-kernel, Vivek Goyal

On Mon, Mar 12, 2012 at 8:04 PM, Tejun Heo <tj@kernel.org> wrote:
> Hello, Sasha.
>
> On Mon, Mar 12, 2012 at 04:01:18PM -0400, Sasha Levin wrote:
>> Since we can't keep rcu read lock during blkg_alloc(), we currently
>> call cgroup_path() without any locks at all.
>>
>> This patch adds cgroup locking before calling cgroup_path.
>>
>> This also fixes a lockdep warning on boot.
>>
>> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
>
> Which branch is this against?  There's already pending stat update
> patch from Vivek which fix this problem along with the percpu
> allocation problem.
>
> Thanks.

I've fixed it for linux-next.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] blk-cgroup: Call cgroup_path only under cgroup lock
  2012-03-12 18:06   ` Sasha Levin
@ 2012-03-12 18:12     ` Tejun Heo
  0 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2012-03-12 18:12 UTC (permalink / raw)
  To: Sasha Levin; +Cc: axboe, linux-kernel, Vivek Goyal

On Mon, Mar 12, 2012 at 08:06:53PM +0200, Sasha Levin wrote:
> On Mon, Mar 12, 2012 at 8:04 PM, Tejun Heo <tj@kernel.org> wrote:
> > Hello, Sasha.
> >
> > On Mon, Mar 12, 2012 at 04:01:18PM -0400, Sasha Levin wrote:
> >> Since we can't keep rcu read lock during blkg_alloc(), we currently
> >> call cgroup_path() without any locks at all.
> >>
> >> This patch adds cgroup locking before calling cgroup_path.
> >>
> >> This also fixes a lockdep warning on boot.
> >>
> >> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> >
> > Which branch is this against?  There's already pending stat update
> > patch from Vivek which fix this problem along with the percpu
> > allocation problem.
> >
> > Thanks.
> 
> I've fixed it for linux-next.

Jens, the pending stats patchset should fix this problem too.  Can you
please put them on top of other blkcg updates?

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] blk-cgroup: Call cgroup_path only under cgroup lock
@ 2012-03-12 20:01 Sasha Levin
  2012-03-12 18:04 ` Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Sasha Levin @ 2012-03-12 20:01 UTC (permalink / raw)
  To: axboe; +Cc: tj, linux-kernel, Sasha Levin

Since we can't keep rcu read lock during blkg_alloc(), we currently
call cgroup_path() without any locks at all.

This patch adds cgroup locking before calling cgroup_path.

This also fixes a lockdep warning on boot.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 block/blk-cgroup.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index cb6b176..b5f539c 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -508,7 +508,9 @@ static struct blkio_group *blkg_alloc(struct blkio_cgroup *blkcg,
 	INIT_LIST_HEAD(&blkg->q_node);
 	blkg->blkcg = blkcg;
 	blkg->refcnt = 1;
+	cgroup_lock();
 	cgroup_path(blkcg->css.cgroup, blkg->path, sizeof(blkg->path));
+	cgroup_unlock();
 
 	for (i = 0; i < BLKIO_NR_POLICIES; i++) {
 		struct blkio_policy_type *pol = blkio_policy[i];
-- 
1.7.8.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-03-12 18:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-12 20:01 [PATCH] blk-cgroup: Call cgroup_path only under cgroup lock Sasha Levin
2012-03-12 18:04 ` Tejun Heo
2012-03-12 18:06   ` Sasha Levin
2012-03-12 18:12     ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox