[systemd-devel] [PATCH] core: don't complain if cgroup property is missing

Lennart Poettering lennart at poettering.net
Fri Aug 15 02:46:48 PDT 2014


On Fri, 15.08.14 09:12, Umut Tezduyar Lindskog (umut at tezduyar.com) wrote:

> 
> On Fri, Aug 15, 2014 at 2:45 AM, Lennart Poettering
> <lennart at poettering.net> wrote:
> > On Fri, 15.08.14 02:42, Lennart Poettering (lennart at poettering.net) wrote:
> >
> >>
> >> On Tue, 15.07.14 11:53, Umut Tezduyar Lindskog (umut.tezduyar at axis.com) wrote:
> >>
> >> Looks Ok, but doesn't apply to currently git anymore...
> >
> > (In case this wasn't clear, please rebase and I'll commit this. -- Or
> > actually, could you add a short comment explaining that EACCES is what
> > the kernel returns if CFS quotas are disabled?)
> 
> Hi,
> 
> I think there is a misunderstanding. Cgroup properties do not exist if
> they are turned off. And since your concern is EACCESS, I think a
> "file exists?" check inside cg_set_attribute before we call
> "write_string_file" is more proper in this case.

Hmm, OK, so I wonder if this is simply the case because we ask the file
to be written with O_CREAT. Because you cannot create files on cgroups
this will result in EACCES. Now, of course, we actually never really
want to create the files, so if we drop the O_CREAT we should probably
get ENOENT instead, which would be so much nicer to check for.

The O_CREAT is done because opf fopen(.., "we") inside of
write_string_file(), inside of cg_set_attribute(). Now, there's
apparently no way to make fopen() open a file for writing without
O_CREAT. We hence have to build our own version, by combining open() and
fdopen()...

Anyway, could you have a look at this? We probably want an entirely new
function write_string_file_nocreate() or so, which does this, and then
make the cgroup code use that...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list