* Ivana Varekova <[email protected]> [2010-09-23 14:58:55]:

> On 09/23/2010 12:43 PM, Balbir Singh wrote:
> >* Ivana Varekova<[email protected]>  [2010-09-23 12:13:09]:
> >
> >>There is a problem in cgroup_init function
> >>    Now if the function strtok_r get at first the controller which
> >>precedes some other controllers on the mount-point option list,
> >>then it removes all next controllers from the list and they are omitted.
> >>    The test which is done by strtok_r is redundant (there is already
> >>hasmntopt test), so the patch is removing it at all.
> >>
> >>  E.G. use commands:
> >>
> >>$ mount -t cgroup -o cpu,memory,net_cls lab1 /cgroup/lab1
> >>$ mount -t cgroup -o remount,cpuset,cpu,memory,net_cls lab1 /cgroup/lab1
> >>$ lssubsys -ma
> >>
> >>Signed-off-by: Ivana Hutarova Varekova<[email protected]>
> >>---
> >>
> >>  src/api.c |    7 +------
> >>  1 files changed, 1 insertions(+), 6 deletions(-)
> >>
> >>diff --git a/src/api.c b/src/api.c
> >>index 1e6e3c3..6cd0185 100644
> >>--- a/src/api.c
> >>+++ b/src/api.c
> >>@@ -733,12 +733,7 @@ int cgroup_init(void)
> >>                    if (!mntopt)
> >>                            continue;
> >>
> >>-                   mntopt = strtok_r(mntopt, ",",&strtok_buffer);
> >>-
> >>-                   if (strcmp(mntopt, controllers[i]))
> >>-                           continue;
> >IIRC, hasmntopt returns a substring from /proc/mounts with a ","
> >separated list of controllers. We use this to see if a controller is
> >already mounted. We scan the list from /proc/cgroups and check to see
> >what is already mounted.
> Hello,
> hashmntopt function  scans  the  mntopts  field (substring from
> /proc/mounts with a "," separated list of controllers)  of the
> mntent structure mnt for a substring "controllers[i]". Thus it
> return null string if there is not option equal with
> controllers[i].
>

Oh! yes.
 
> Using strtok_r to mntopts however changes the content of mntopt
> variable and thus broke the ent->mnt_opt data.

Fair enough, thanks

> 
> >>-
> >>-                   cgroup_dbg("matched %s:%s\n", mntopt, controllers[i]);
> >>+                   cgroup_dbg("found %s in %s\n", controllers[i], 
> >>ent->mnt_opts);
> >>
> >>                    /* do not have duplicates in mount table */
> >>                    duplicate = 0;
> >I am afraid I need an example to help understand your use case better.
> The example is at the beginning of the e-mail:
> 
>  E.G. use commands:
> 
> $ mount -t cgroup -o cpu,memory,net_cls lab1 /cgroup/lab1
> $ mount -t cgroup -o remount,cpuset,cpu,memory,net_cls lab1 /cgroup/lab1
> $ lssubsys -ma
>

Thanks, I'll merge them

-- 
        Three Cheers,
        Balbir

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to