Messages in this thread | | | Date | Wed, 22 Jul 2009 23:27:23 -0700 | Subject | Re: [PATCH 1/4] Support named cgroups hierarchies | From | Paul Menage <> |
| |
On Wed, Jul 22, 2009 at 11:20 PM, Li Zefan<lizf@cn.fujitsu.com> wrote: >> +The name should match [\w.-]+ >> + > > "[\w._-]+" ? > > But I double we need to check this.
\w includes '_'
>> static int cgroup_set_super(struct super_block *sb, void *data) >> { >> int ret; >> - struct cgroupfs_root *root = data; >> + struct cgroup_sb_opts *opts = data; >> + >> + /* If we don't have a new root, we can't set up a new sb */ >> + if (!opts->new_root) >> + return -EINVAL; >> + > > I think this should be BUG_ON(). If set_super() is called, > we are allocating a new root, so opts->new_root won't be NULL.
Not true - if you try to mount a hierarchy by name, but with no subsystem options, then we don't construct a new root, but we still call sget(). If we find a superblock with the right name then we use it, else sget() will allocate a new superblock and call cgroup_set_super(), at which point we need to fail.
> >> + struct cgroupfs_root *new_root = cgroup_root_from_opts(&opts); > > Why not just declare new_root in the beginning of cgroup_get_sb()?
Because it's not needed for the entire scope of the function. Keeping its scope as small as possible makes it clearer what it's being used for.
Paul -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |