2010-08-20 08:52:18

by Ciju Rajan K

[permalink] [raw]
Subject: [PATCH]Fix return code for mkdir calls

>From bd2b65775a5b187f7c15c2b6d88f47cd24fb9c4e Mon Sep 17 00:00:00 2001
From: Ciju Rajan K <[email protected]>
Date: Fri, 20 Aug 2010 12:02:45 +0530
Subject: blkio: Fix return code for mkdir calls

If the cgroup hierarchy for blkio control groups is deeper than two
levels, kernel should not allow the creation of further levels. mkdir
system call does not except EINVAL as a return value. This patch
replaces EINVAL with more appropriate EPERM

Signed-off-by: Ciju Rajan K <[email protected]>
---
block/blk-cgroup.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index a680964..2fef1ef 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -966,7 +966,7 @@ blkiocg_create(struct cgroup_subsys *subsys, struct cgroup *cgroup)

/* Currently we do not support hierarchy deeper than two level (0,1) */
if (parent != cgroup->top_cgroup)
- return ERR_PTR(-EINVAL);
+ return ERR_PTR(-EPERM);

blkcg = kzalloc(sizeof(*blkcg), GFP_KERNEL);
if (!blkcg)
--
1.6.0.6



Attachments:
blkio-Fix-the-return-code.patch (1.03 kB)

2010-08-20 08:57:13

by Kamezawa Hiroyuki

[permalink] [raw]
Subject: Re: [PATCH]Fix return code for mkdir calls

On Fri, 20 Aug 2010 14:21:53 +0530
Ciju Rajan K <[email protected]> wrote:

> Hi,
>
> This patch fixes the return value when the cgroup hierarchy for blkio
> control groups is deeper than two levels. Right now EINVAL is returned.
> This patch replaces EINVAL with more appropriate EPERM to align with
> mkdir system call return values. This was discussed between Vivek and
> Daniel sometime back. Please consider this patch for inclusion in 2.6.36.
>
> Thanks
> Ciju
>
Thank you!

Reviewed-by: KAMEZAWA Hiroyuki <[email protected]>

2010-08-23 08:54:45

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH]Fix return code for mkdir calls

On 2010-08-20 10:51, Ciju Rajan K wrote:
> Hi,
>
> This patch fixes the return value when the cgroup hierarchy for blkio
> control groups is deeper than two levels. Right now EINVAL is returned.
> This patch replaces EINVAL with more appropriate EPERM to align with
> mkdir system call return values. This was discussed between Vivek and
> Daniel sometime back. Please consider this patch for inclusion in 2.6.36.
>
> Thanks
> Ciju
>

Thanks, applied.

--
Jens Axboe