public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: axboe@kernel.dk
Cc: vgoyal@redhat.com, ctalbott@google.com, rni@google.com,
	linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
	containers@lists.linux-foundation.org, fengguang.wu@intel.com,
	hughd@google.com, akpm@linux-foundation.org,
	Tejun Heo <tj@kernel.org>
Subject: [PATCH 01/11] blkcg: fix blkg_alloc() failure path
Date: Thu, 26 Apr 2012 14:59:11 -0700	[thread overview]
Message-ID: <1335477561-11131-2-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1335477561-11131-1-git-send-email-tj@kernel.org>

When policy data allocation fails in the middle, blkg_alloc() invokes
blkg_free() to destroy the half constructed blkg.  This ends up
calling pd_exit_fn() on policy datas which didn't go through
pd_init_fn().  Fix it by making blkg_alloc() call pd_init_fn()
immediately after each policy data allocation.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
---
 block/blk-cgroup.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 02cf633..4ab7420 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -125,12 +125,8 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q)
 
 		blkg->pd[i] = pd;
 		pd->blkg = blkg;
-	}
-
-	/* invoke per-policy init */
-	for (i = 0; i < BLKCG_MAX_POLS; i++) {
-		struct blkcg_policy *pol = blkcg_policy[i];
 
+		/* invoke per-policy init */
 		if (blkcg_policy_enabled(blkg->q, pol))
 			pol->pd_init_fn(blkg);
 	}
-- 
1.7.7.3


  reply	other threads:[~2012-04-26 22:03 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-26 21:59 [PATCHSET] block: implement per-blkg request allocation Tejun Heo
2012-04-26 21:59 ` Tejun Heo [this message]
2012-04-27 14:26   ` [PATCH 01/11] blkcg: fix blkg_alloc() failure path Vivek Goyal
2012-04-27 14:27     ` Tejun Heo
2012-04-26 21:59 ` [PATCH 02/11] blkcg: __blkg_lookup_create() doesn't have to fail on radix tree preload failure Tejun Heo
2012-04-27 14:42   ` Vivek Goyal
2012-04-27 14:47     ` Tejun Heo
2012-04-27 21:18   ` [PATCH UPDATED 02/11] blkcg: __blkg_lookup_create() doesn't need radix preload Tejun Heo
2012-04-26 21:59 ` [PATCH 03/11] blkcg: make root blkcg allocation use %GFP_KERNEL Tejun Heo
2012-04-27 21:19   ` [PATCH UPDATED " Tejun Heo
2012-04-26 21:59 ` [PATCH 04/11] mempool: add @gfp_mask to mempool_create_node() Tejun Heo
2012-04-26 21:59 ` [PATCH 05/11] block: drop custom queue draining used by scsi_transport_{iscsi|fc} Tejun Heo
2012-05-02  4:55   ` Mike Christie
2012-04-26 21:59 ` [PATCH 06/11] block: refactor get_request[_wait]() Tejun Heo
2012-04-26 21:59 ` [PATCH 07/11] block: allocate io_context upfront Tejun Heo
2012-04-26 21:59 ` [PATCH 08/11] blkcg: inline bio_blkcg() and friends Tejun Heo
2012-04-26 21:59 ` [PATCH 09/11] block: add q->nr_rqs[] and move q->rq.elvpriv to q->nr_rqs_elvpriv Tejun Heo
2012-04-26 21:59 ` [PATCH 10/11] block: prepare for multiple request_lists Tejun Heo
2012-04-26 21:59 ` [PATCH 11/11] blkcg: implement per-blkg request allocation Tejun Heo
2012-04-27 14:54   ` Jeff Moyer
2012-04-27 15:02     ` Tejun Heo
2012-04-27 15:40       ` Vivek Goyal
2012-04-27 15:45         ` Tejun Heo
2012-04-27 15:48           ` Vivek Goyal
2012-04-27 15:51             ` Tejun Heo
2012-04-27 15:56               ` Vivek Goyal
2012-04-27 16:19                 ` Vivek Goyal
2012-04-27 16:20                 ` Tejun Heo
2012-04-27 17:21                   ` Vivek Goyal
2012-04-27 17:25                     ` Tejun Heo
2012-04-27 19:46   ` Vivek Goyal
2012-04-27 20:15     ` Tejun Heo
2012-04-27 20:21       ` Vivek Goyal

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=1335477561-11131-2-git-send-email-tj@kernel.org \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=containers@lists.linux-foundation.org \
    --cc=ctalbott@google.com \
    --cc=fengguang.wu@intel.com \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rni@google.com \
    --cc=vgoyal@redhat.com \
    /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