mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sasha Levin <levinsasha928@gmail.com>
To: axboe@kernel.dk
Cc: tj@kernel.org, linux-kernel@vger.kernel.org,
	Sasha Levin <levinsasha928@gmail.com>
Subject: [PATCH] blk-cgroup: Call cgroup_path only under cgroup lock
Date: Mon, 12 Mar 2012 16:01:18 -0400	[thread overview]
Message-ID: <1331582478-2259-1-git-send-email-levinsasha928@gmail.com> (raw)

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


             reply	other threads:[~2012-03-12 18:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-12 20:01 Sasha Levin [this message]
2012-03-12 18:04 ` Tejun Heo
2012-03-12 18:06   ` Sasha Levin
2012-03-12 18:12     ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1331582478-2259-1-git-send-email-levinsasha928@gmail.com \
    --to=levinsasha928@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®