Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

[PATCH v3.5-rc1] blkcg: fix blkg_alloc() failure path

 

 

Linux kernel RSS feed   Index | Next | Previous | View Threaded


tj at kernel

Jun 3, 2012, 11:21 PM

Post #1 of 2 (74 views)
Permalink
[PATCH v3.5-rc1] blkcg: fix blkg_alloc() failure path

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 [at] kernel>
Acked-by: Vivek Goyal <vgoyal [at] redhat>
---
Jens, this was posted as part of "block: implement per-blkg request
allocation" patchset[1] but should be applied as fix on v3.5-rc1.

[1] http://thread.gmane.org/gmane.linux.kernel.containers/23159/focus=2007

block/blk-cgroup.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -125,12 +125,8 @@ static struct blkcg_gq *blkg_alloc(struc

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);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


axboe at kernel

Jun 4, 2012, 6:23 AM

Post #2 of 2 (68 views)
Permalink
Re: [PATCH v3.5-rc1] blkcg: fix blkg_alloc() failure path [In reply to]

On 06/04/2012 08:21 AM, Tejun Heo wrote:
> 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 [at] kernel>
> Acked-by: Vivek Goyal <vgoyal [at] redhat>
> ---
> Jens, this was posted as part of "block: implement per-blkg request
> allocation" patchset[1] but should be applied as fix on v3.5-rc1.

Applied for 3.5 current, thanks.

--
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.