public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] cgroup allow subsys to set default mode of its own file
@ 2009-02-25  7:35 KAMEZAWA Hiroyuki
  2009-02-25  7:37 ` [PATCH 2/2] cgroup/memcg show correct file mode KAMEZAWA Hiroyuki
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-02-25  7:35 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org
  Cc: containers@lists.linux-foundation.org, menage@google.com,
	lizf@cn.fujitsu.com, akpm@linux-foundation.org,
	balbir@linux.vnet.ibm.com

From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

cgroup's subsys has "readonly" files, but default permission is always
rw-r--r--. This allows to create r--r--r-- file to subsys.
(The user can do chmod on this read-only file. But this behavior is not
 different from current pseudo file systems as /proc.)

Reason:
 When I wrote tools for maintain cgroup, I can't find which file is
 writable intarfece or not via cgroup file systems. (finally, I did
 dirty approach.)
 IMHO, showing "this file is read-only" in explicit way is useful
 for user-land (tools). In other story, a file whose name sounds read-only
 may have "trigger" operation and support reseting. In this case,
 "writable" is informative.
 

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
 include/linux/cgroup.h |    2 ++
 kernel/cgroup.c        |    5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

Index: mmotm-2.6.29-Feb24/include/linux/cgroup.h
===================================================================
--- mmotm-2.6.29-Feb24.orig/include/linux/cgroup.h
+++ mmotm-2.6.29-Feb24/include/linux/cgroup.h
@@ -258,6 +258,8 @@ struct cftype {
 	 */
 	char name[MAX_CFTYPE_NAME];
 	int private;
+	/* if not 0, mode is set to mode, otherwise 0644 */
+	int mode;
 
 	/*
 	 * If non-zero, defines the maximum length of string that can
Index: mmotm-2.6.29-Feb24/kernel/cgroup.c
===================================================================
--- mmotm-2.6.29-Feb24.orig/kernel/cgroup.c
+++ mmotm-2.6.29-Feb24/kernel/cgroup.c
@@ -1767,7 +1767,10 @@ int cgroup_add_file(struct cgroup *cgrp,
 	BUG_ON(!mutex_is_locked(&dir->d_inode->i_mutex));
 	dentry = lookup_one_len(name, dir, strlen(name));
 	if (!IS_ERR(dentry)) {
-		error = cgroup_create_file(dentry, 0644 | S_IFREG,
+		int mode = 0644;
+		if (cft->mode)
+			mode = cft->mode;
+		error = cgroup_create_file(dentry, mode | S_IFREG,
 						cgrp->root->sb);
 		if (!error)
 			dentry->d_fsdata = (void *)cft;


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

* [PATCH 2/2] cgroup/memcg show correct file mode
  2009-02-25  7:35 [PATCH 1/2] cgroup allow subsys to set default mode of its own file KAMEZAWA Hiroyuki
@ 2009-02-25  7:37 ` KAMEZAWA Hiroyuki
  2009-02-25  8:03   ` Balbir Singh
  2009-02-25  8:01 ` [PATCH 1/2] cgroup allow subsys to set default mode of its own file Li Zefan
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-02-25  7:37 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: linux-kernel@vger.kernel.org,
	containers@lists.linux-foundation.org, menage@google.com,
	lizf@cn.fujitsu.com, akpm@linux-foundation.org,
	balbir@linux.vnet.ibm.com

From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

Set correct permission to memcg's file.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
 mm/memcontrol.c |    4 ++++
 1 file changed, 4 insertions(+)

Index: mmotm-2.6.29-Feb24/mm/memcontrol.c
===================================================================
--- mmotm-2.6.29-Feb24.orig/mm/memcontrol.c
+++ mmotm-2.6.29-Feb24/mm/memcontrol.c
@@ -2218,6 +2218,7 @@ static struct cftype mem_cgroup_files[] 
 		.name = "usage_in_bytes",
 		.private = MEMFILE_PRIVATE(_MEM, RES_USAGE),
 		.read_u64 = mem_cgroup_read,
+		.mode = 0444
 	},
 	{
 		.name = "max_usage_in_bytes",
@@ -2240,10 +2241,12 @@ static struct cftype mem_cgroup_files[] 
 	{
 		.name = "stat",
 		.read_map = mem_control_stat_show,
+		.mode = 0444
 	},
 	{
 		.name = "force_empty",
 		.trigger = mem_cgroup_force_empty_write,
+		.mode = 0200
 	},
 	{
 		.name = "use_hierarchy",
@@ -2263,6 +2266,7 @@ static struct cftype memsw_cgroup_files[
 		.name = "memsw.usage_in_bytes",
 		.private = MEMFILE_PRIVATE(_MEMSWAP, RES_USAGE),
 		.read_u64 = mem_cgroup_read,
+		.mode = 0444
 	},
 	{
 		.name = "memsw.max_usage_in_bytes",


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

* Re: [PATCH 1/2] cgroup allow subsys to set default mode of its own file
  2009-02-25  7:35 [PATCH 1/2] cgroup allow subsys to set default mode of its own file KAMEZAWA Hiroyuki
  2009-02-25  7:37 ` [PATCH 2/2] cgroup/memcg show correct file mode KAMEZAWA Hiroyuki
@ 2009-02-25  8:01 ` Li Zefan
  2009-02-25  8:03 ` Balbir Singh
  2009-02-26 21:00 ` Andrew Morton
  3 siblings, 0 replies; 13+ messages in thread
From: Li Zefan @ 2009-02-25  8:01 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: linux-kernel@vger.kernel.org,
	containers@lists.linux-foundation.org, menage@google.com,
	akpm@linux-foundation.org, balbir@linux.vnet.ibm.com

KAMEZAWA Hiroyuki wrote:
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> cgroup's subsys has "readonly" files, but default permission is always
> rw-r--r--. This allows to create r--r--r-- file to subsys.
> (The user can do chmod on this read-only file. But this behavior is not
>  different from current pseudo file systems as /proc.)
> 
> Reason:
>  When I wrote tools for maintain cgroup, I can't find which file is
>  writable intarfece or not via cgroup file systems. (finally, I did
>  dirty approach.)
>  IMHO, showing "this file is read-only" in explicit way is useful
>  for user-land (tools). In other story, a file whose name sounds read-only
>  may have "trigger" operation and support reseting. In this case,
>  "writable" is informative.
>  

I once planed to do so. I think there's one trial issue, that some files are
read-only in top-cgroup, but read-write in sub-dirs, like cpuset.cpus and
cpuset.mems. But for those files, they must have a write function, so I think
it's still valid to mask them as read-write even they are in top-cgroup.

Unless Paul has different option towards this:

Acked-by: Li Zefan <lizf@cn.fujitsu.cn>

> 
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> ---
>  include/linux/cgroup.h |    2 ++
>  kernel/cgroup.c        |    5 ++++-
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> Index: mmotm-2.6.29-Feb24/include/linux/cgroup.h
> ===================================================================
> --- mmotm-2.6.29-Feb24.orig/include/linux/cgroup.h
> +++ mmotm-2.6.29-Feb24/include/linux/cgroup.h
> @@ -258,6 +258,8 @@ struct cftype {
>  	 */
>  	char name[MAX_CFTYPE_NAME];
>  	int private;
> +	/* if not 0, mode is set to mode, otherwise 0644 */
> +	int mode;
>  
>  	/*
>  	 * If non-zero, defines the maximum length of string that can
> Index: mmotm-2.6.29-Feb24/kernel/cgroup.c
> ===================================================================
> --- mmotm-2.6.29-Feb24.orig/kernel/cgroup.c
> +++ mmotm-2.6.29-Feb24/kernel/cgroup.c
> @@ -1767,7 +1767,10 @@ int cgroup_add_file(struct cgroup *cgrp,
>  	BUG_ON(!mutex_is_locked(&dir->d_inode->i_mutex));
>  	dentry = lookup_one_len(name, dir, strlen(name));
>  	if (!IS_ERR(dentry)) {
> -		error = cgroup_create_file(dentry, 0644 | S_IFREG,
> +		int mode = 0644;
> +		if (cft->mode)
> +			mode = cft->mode;
> +		error = cgroup_create_file(dentry, mode | S_IFREG,
>  						cgrp->root->sb);
>  		if (!error)
>  			dentry->d_fsdata = (void *)cft;
> 

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

* Re: [PATCH 1/2] cgroup allow subsys to set default mode of its own file
  2009-02-25  7:35 [PATCH 1/2] cgroup allow subsys to set default mode of its own file KAMEZAWA Hiroyuki
  2009-02-25  7:37 ` [PATCH 2/2] cgroup/memcg show correct file mode KAMEZAWA Hiroyuki
  2009-02-25  8:01 ` [PATCH 1/2] cgroup allow subsys to set default mode of its own file Li Zefan
@ 2009-02-25  8:03 ` Balbir Singh
  2009-02-26 21:00 ` Andrew Morton
  3 siblings, 0 replies; 13+ messages in thread
From: Balbir Singh @ 2009-02-25  8:03 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: linux-kernel@vger.kernel.org,
	containers@lists.linux-foundation.org, menage@google.com,
	lizf@cn.fujitsu.com, akpm@linux-foundation.org

* KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2009-02-25 16:35:55]:

> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> cgroup's subsys has "readonly" files, but default permission is always
> rw-r--r--. This allows to create r--r--r-- file to subsys.
> (The user can do chmod on this read-only file. But this behavior is not
>  different from current pseudo file systems as /proc.)
> 
> Reason:
>  When I wrote tools for maintain cgroup, I can't find which file is
>  writable intarfece or not via cgroup file systems. (finally, I did
>  dirty approach.)
>  IMHO, showing "this file is read-only" in explicit way is useful
>  for user-land (tools). In other story, a file whose name sounds read-only
>  may have "trigger" operation and support reseting. In this case,
>  "writable" is informative.

Perfect, Thanks, Looks good to me

-- 
	Balbir

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

* Re: [PATCH 2/2] cgroup/memcg show correct file mode
  2009-02-25  7:37 ` [PATCH 2/2] cgroup/memcg show correct file mode KAMEZAWA Hiroyuki
@ 2009-02-25  8:03   ` Balbir Singh
  2009-02-25  8:09     ` Dhaval Giani
  0 siblings, 1 reply; 13+ messages in thread
From: Balbir Singh @ 2009-02-25  8:03 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: linux-kernel@vger.kernel.org,
	containers@lists.linux-foundation.org, menage@google.com,
	lizf@cn.fujitsu.com, akpm@linux-foundation.org

* KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2009-02-25 16:37:29]:

> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> Set correct permission to memcg's file.
> 
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> ---
>  mm/memcontrol.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> Index: mmotm-2.6.29-Feb24/mm/memcontrol.c
> ===================================================================
> --- mmotm-2.6.29-Feb24.orig/mm/memcontrol.c
> +++ mmotm-2.6.29-Feb24/mm/memcontrol.c
> @@ -2218,6 +2218,7 @@ static struct cftype mem_cgroup_files[] 
>  		.name = "usage_in_bytes",
>  		.private = MEMFILE_PRIVATE(_MEM, RES_USAGE),
>  		.read_u64 = mem_cgroup_read,
> +		.mode = 0444
>  	},
>  	{
>  		.name = "max_usage_in_bytes",
> @@ -2240,10 +2241,12 @@ static struct cftype mem_cgroup_files[] 
>  	{
>  		.name = "stat",
>  		.read_map = mem_control_stat_show,
> +		.mode = 0444
>  	},
>  	{
>  		.name = "force_empty",
>  		.trigger = mem_cgroup_force_empty_write,
> +		.mode = 0200
>  	},
>  	{
>  		.name = "use_hierarchy",
> @@ -2263,6 +2266,7 @@ static struct cftype memsw_cgroup_files[
>  		.name = "memsw.usage_in_bytes",
>  		.private = MEMFILE_PRIVATE(_MEMSWAP, RES_USAGE),
>  		.read_u64 = mem_cgroup_read,
> +		.mode = 0444
>  	},
>  	{
>  		.name = "memsw.max_usage_in_bytes",
> 
>

Yes, please, very much required

Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
 

-- 
	Balbir

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

* Re: [PATCH 2/2] cgroup/memcg show correct file mode
  2009-02-25  8:03   ` Balbir Singh
@ 2009-02-25  8:09     ` Dhaval Giani
  0 siblings, 0 replies; 13+ messages in thread
From: Dhaval Giani @ 2009-02-25  8:09 UTC (permalink / raw)
  To: Balbir Singh
  Cc: KAMEZAWA Hiroyuki, linux-kernel@vger.kernel.org,
	containers@lists.linux-foundation.org, menage@google.com,
	lizf@cn.fujitsu.com, akpm@linux-foundation.org

On Wed, Feb 25, 2009 at 01:33:29PM +0530, Balbir Singh wrote:
> * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2009-02-25 16:37:29]:
> 
> > From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> > 
> > Set correct permission to memcg's file.
> > 
> > Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> > ---
> >  mm/memcontrol.c |    4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > Index: mmotm-2.6.29-Feb24/mm/memcontrol.c
> > ===================================================================
> > --- mmotm-2.6.29-Feb24.orig/mm/memcontrol.c
> > +++ mmotm-2.6.29-Feb24/mm/memcontrol.c
> > @@ -2218,6 +2218,7 @@ static struct cftype mem_cgroup_files[] 
> >  		.name = "usage_in_bytes",
> >  		.private = MEMFILE_PRIVATE(_MEM, RES_USAGE),
> >  		.read_u64 = mem_cgroup_read,
> > +		.mode = 0444
> >  	},
> >  	{
> >  		.name = "max_usage_in_bytes",
> > @@ -2240,10 +2241,12 @@ static struct cftype mem_cgroup_files[] 
> >  	{
> >  		.name = "stat",
> >  		.read_map = mem_control_stat_show,
> > +		.mode = 0444
> >  	},
> >  	{
> >  		.name = "force_empty",
> >  		.trigger = mem_cgroup_force_empty_write,
> > +		.mode = 0200
> >  	},
> >  	{
> >  		.name = "use_hierarchy",
> > @@ -2263,6 +2266,7 @@ static struct cftype memsw_cgroup_files[
> >  		.name = "memsw.usage_in_bytes",
> >  		.private = MEMFILE_PRIVATE(_MEMSWAP, RES_USAGE),
> >  		.read_u64 = mem_cgroup_read,
> > +		.mode = 0444
> >  	},
> >  	{
> >  		.name = "memsw.max_usage_in_bytes",
> > 
> >
> 
> Yes, please, very much required
> 
> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>

I agree,

Acked-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
-- 
regards,
Dhaval

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

* Re: [PATCH 1/2] cgroup allow subsys to set default mode of its own file
  2009-02-25  7:35 [PATCH 1/2] cgroup allow subsys to set default mode of its own file KAMEZAWA Hiroyuki
                   ` (2 preceding siblings ...)
  2009-02-25  8:03 ` Balbir Singh
@ 2009-02-26 21:00 ` Andrew Morton
  2009-02-27  0:20   ` KAMEZAWA Hiroyuki
  2009-02-27  0:28   ` Paul Menage
  3 siblings, 2 replies; 13+ messages in thread
From: Andrew Morton @ 2009-02-26 21:00 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki; +Cc: linux-kernel, containers, menage, lizf, balbir

On Wed, 25 Feb 2009 16:35:55 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:

>  When I wrote tools for maintain cgroup, I can't find which file is
>  writable intarfece or not via cgroup file systems. (finally, I did
>  dirty approach.)
>  IMHO, showing "this file is read-only" in explicit way is useful
>  for user-land (tools). In other story, a file whose name sounds read-only
>  may have "trigger" operation and support reseting. In this case,
>  "writable" is informative.

Well, we have compatibility issues here.  If we make this change, and
people write tools which depend upon that change then those tools might
break when run upon older kernels.  Or they need back-compatibility
additions, which increases the testing burden of those tools.

One way in which we could improve this situation is to backport these
changes into earlier kernels, although I don't know which versions.

What do we think?

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

* Re: [PATCH 1/2] cgroup allow subsys to set default mode of its own file
  2009-02-26 21:00 ` Andrew Morton
@ 2009-02-27  0:20   ` KAMEZAWA Hiroyuki
  2009-02-27  5:08     ` Dhaval Giani
  2009-02-27  5:12     ` Balbir Singh
  2009-02-27  0:28   ` Paul Menage
  1 sibling, 2 replies; 13+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-02-27  0:20 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, containers, menage, lizf, balbir

On Thu, 26 Feb 2009 13:00:05 -0800
Andrew Morton <akpm@linux-foundation.org> wrote:

> On Wed, 25 Feb 2009 16:35:55 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> 
> >  When I wrote tools for maintain cgroup, I can't find which file is
> >  writable intarfece or not via cgroup file systems. (finally, I did
> >  dirty approach.)
> >  IMHO, showing "this file is read-only" in explicit way is useful
> >  for user-land (tools). In other story, a file whose name sounds read-only
> >  may have "trigger" operation and support reseting. In this case,
> >  "writable" is informative.
> 
> Well, we have compatibility issues here.  If we make this change, and
> people write tools which depend upon that change then those tools might
> break when run upon older kernels.  Or they need back-compatibility
> additions, which increases the testing burden of those tools.
> 
> One way in which we could improve this situation is to backport these
> changes into earlier kernels, although I don't know which versions.
> 
> What do we think?
> 
It sounds problem to me.

Hmm..1st commit to kernel/cgroup.c is 2007-10-19, then 2.6.24 is the oldest one.
But I think distro's tools for cgroup is not as old as...
Hmm, backport to 2.6.25 is enough ?
Balbir, how do you think ? I think you are familiar with libcgroup.

Thanks,
-Kame


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

* Re: [PATCH 1/2] cgroup allow subsys to set default mode of its own  file
  2009-02-26 21:00 ` Andrew Morton
  2009-02-27  0:20   ` KAMEZAWA Hiroyuki
@ 2009-02-27  0:28   ` Paul Menage
  2009-02-27  0:38     ` KAMEZAWA Hiroyuki
  2009-02-27  0:40     ` Li Zefan
  1 sibling, 2 replies; 13+ messages in thread
From: Paul Menage @ 2009-02-27  0:28 UTC (permalink / raw)
  To: Andrew Morton; +Cc: KAMEZAWA Hiroyuki, linux-kernel, containers, lizf, balbir

On Thu, Feb 26, 2009 at 1:00 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Wed, 25 Feb 2009 16:35:55 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
>
>>  When I wrote tools for maintain cgroup, I can't find which file is
>>  writable intarfece or not via cgroup file systems. (finally, I did
>>  dirty approach.)
>>  IMHO, showing "this file is read-only" in explicit way is useful
>>  for user-land (tools). In other story, a file whose name sounds read-only
>>  may have "trigger" operation and support reseting. In this case,
>>  "writable" is informative.
>
> Well, we have compatibility issues here.  If we make this change, and
> people write tools which depend upon that change then those tools might
> break when run upon older kernels.

I don't think that's too big a deal - a write can always fail at the
whim of a cgroups subsystem, so this would just be a hint to a tool
that it shouldn't even bother trying to write to the file. It should
be able to handle a failure.

But I don't see why we can't figure out the mode automatically based
on whether or not there's a write handler defined for the control
file.

Paul

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

* Re: [PATCH 1/2] cgroup allow subsys to set default mode of its own file
  2009-02-27  0:28   ` Paul Menage
@ 2009-02-27  0:38     ` KAMEZAWA Hiroyuki
  2009-02-27  0:40     ` Li Zefan
  1 sibling, 0 replies; 13+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-02-27  0:38 UTC (permalink / raw)
  To: Paul Menage; +Cc: Andrew Morton, linux-kernel, containers, lizf, balbir

On Thu, 26 Feb 2009 16:28:11 -0800
Paul Menage <menage@google.com> wrote:

> On Thu, Feb 26, 2009 at 1:00 PM, Andrew Morton
> <akpm@linux-foundation.org> wrote:
> > On Wed, 25 Feb 2009 16:35:55 +0900
> > KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> >
> >>  When I wrote tools for maintain cgroup, I can't find which file is
> >>  writable intarfece or not via cgroup file systems. (finally, I did
> >>  dirty approach.)
> >>  IMHO, showing "this file is read-only" in explicit way is useful
> >>  for user-land (tools). In other story, a file whose name sounds read-only
> >>  may have "trigger" operation and support reseting. In this case,
> >>  "writable" is informative.
> >
> > Well, we have compatibility issues here.  If we make this change, and
> > people write tools which depend upon that change then those tools might
> > break when run upon older kernels.
> 
> I don't think that's too big a deal - a write can always fail at the
> whim of a cgroups subsystem, so this would just be a hint to a tool
> that it shouldn't even bother trying to write to the file. It should
> be able to handle a failure.
> 
> But I don't see why we can't figure out the mode automatically based
> on whether or not there's a write handler defined for the control
> file.
> 
That's because I wanted to allow -w------- or -w--w---- or some

Thanks,
-Kame



> Paul
> 


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

* Re: [PATCH 1/2] cgroup allow subsys to set default mode of its own file
  2009-02-27  0:28   ` Paul Menage
  2009-02-27  0:38     ` KAMEZAWA Hiroyuki
@ 2009-02-27  0:40     ` Li Zefan
  1 sibling, 0 replies; 13+ messages in thread
From: Li Zefan @ 2009-02-27  0:40 UTC (permalink / raw)
  To: Paul Menage
  Cc: Andrew Morton, KAMEZAWA Hiroyuki, linux-kernel, containers,
	balbir

> But I don't see why we can't figure out the mode automatically based
> on whether or not there's a write handler defined for the control
> file.
> 

This almost works.. except for 'tasks' file, which has no 'read' handler
but is readable.


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

* Re: [PATCH 1/2] cgroup allow subsys to set default mode of its own file
  2009-02-27  0:20   ` KAMEZAWA Hiroyuki
@ 2009-02-27  5:08     ` Dhaval Giani
  2009-02-27  5:12     ` Balbir Singh
  1 sibling, 0 replies; 13+ messages in thread
From: Dhaval Giani @ 2009-02-27  5:08 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: Andrew Morton, linux-kernel, containers, menage, lizf, balbir

On Fri, Feb 27, 2009 at 09:20:31AM +0900, KAMEZAWA Hiroyuki wrote:
> On Thu, 26 Feb 2009 13:00:05 -0800
> Andrew Morton <akpm@linux-foundation.org> wrote:
> 
> > On Wed, 25 Feb 2009 16:35:55 +0900
> > KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > 
> > >  When I wrote tools for maintain cgroup, I can't find which file is
> > >  writable intarfece or not via cgroup file systems. (finally, I did
> > >  dirty approach.)
> > >  IMHO, showing "this file is read-only" in explicit way is useful
> > >  for user-land (tools). In other story, a file whose name sounds read-only
> > >  may have "trigger" operation and support reseting. In this case,
> > >  "writable" is informative.
> > 
> > Well, we have compatibility issues here.  If we make this change, and
> > people write tools which depend upon that change then those tools might
> > break when run upon older kernels.  Or they need back-compatibility
> > additions, which increases the testing burden of those tools.
> > 
> > One way in which we could improve this situation is to backport these
> > changes into earlier kernels, although I don't know which versions.
> > 
> > What do we think?
> > 
> It sounds problem to me.
> 
> Hmm..1st commit to kernel/cgroup.c is 2007-10-19, then 2.6.24 is the oldest one.
> But I think distro's tools for cgroup is not as old as...
> Hmm, backport to 2.6.25 is enough ?
> Balbir, how do you think ? I think you are familiar with libcgroup.
> 

I would like to have this backported to at least the distro kernels.

thanks,
-- 
regards,
Dhaval

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

* Re: [PATCH 1/2] cgroup allow subsys to set default mode of its own file
  2009-02-27  0:20   ` KAMEZAWA Hiroyuki
  2009-02-27  5:08     ` Dhaval Giani
@ 2009-02-27  5:12     ` Balbir Singh
  1 sibling, 0 replies; 13+ messages in thread
From: Balbir Singh @ 2009-02-27  5:12 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki; +Cc: Andrew Morton, menage, containers, linux-kernel

* KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2009-02-27 09:20:31]:

> On Thu, 26 Feb 2009 13:00:05 -0800
> Andrew Morton <akpm@linux-foundation.org> wrote:
> 
> > On Wed, 25 Feb 2009 16:35:55 +0900
> > KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > 
> > >  When I wrote tools for maintain cgroup, I can't find which file is
> > >  writable intarfece or not via cgroup file systems. (finally, I did
> > >  dirty approach.)
> > >  IMHO, showing "this file is read-only" in explicit way is useful
> > >  for user-land (tools). In other story, a file whose name sounds read-only
> > >  may have "trigger" operation and support reseting. In this case,
> > >  "writable" is informative.
> > 
> > Well, we have compatibility issues here.  If we make this change, and
> > people write tools which depend upon that change then those tools might
> > break when run upon older kernels.  Or they need back-compatibility
> > additions, which increases the testing burden of those tools.
> > 
> > One way in which we could improve this situation is to backport these
> > changes into earlier kernels, although I don't know which versions.
> > 
> > What do we think?
> > 
> It sounds problem to me.
> 
> Hmm..1st commit to kernel/cgroup.c is 2007-10-19, then 2.6.24 is the oldest one.
> But I think distro's tools for cgroup is not as old as...
> Hmm, backport to 2.6.25 is enough ?
> Balbir, how do you think ? I think you are familiar with libcgroup.
>

Actually this problem fixes an issue that we've seen in libcgroup,
where a file would have read permission (force_empty), but reading it
would fail, Porting back to 2.6.25 would be nice (since the memcg
merge) 

-- 
	Balbir

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

end of thread, other threads:[~2009-02-27  5:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-25  7:35 [PATCH 1/2] cgroup allow subsys to set default mode of its own file KAMEZAWA Hiroyuki
2009-02-25  7:37 ` [PATCH 2/2] cgroup/memcg show correct file mode KAMEZAWA Hiroyuki
2009-02-25  8:03   ` Balbir Singh
2009-02-25  8:09     ` Dhaval Giani
2009-02-25  8:01 ` [PATCH 1/2] cgroup allow subsys to set default mode of its own file Li Zefan
2009-02-25  8:03 ` Balbir Singh
2009-02-26 21:00 ` Andrew Morton
2009-02-27  0:20   ` KAMEZAWA Hiroyuki
2009-02-27  5:08     ` Dhaval Giani
2009-02-27  5:12     ` Balbir Singh
2009-02-27  0:28   ` Paul Menage
2009-02-27  0:38     ` KAMEZAWA Hiroyuki
2009-02-27  0:40     ` Li Zefan

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