mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* cgroup namespaces - mount root
@ 2016-03-11 21:50 Serge E. Hallyn
  2016-03-16 21:46 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Serge E. Hallyn @ 2016-03-11 21:50 UTC (permalink / raw)
  To: Tejun Heo, lkml

Hi Tejun,

One practical problem I've found with cgroup namespaces is that there
is no way to disambiguate between a cgroupfs mount which was done in
a cgroup namespace, and a bind mount of a cgroupfs directory.  So
whether I do

unshare --cgroup -- bash -c "mount -t cgroup -o freezer f /mnt; cat /proc/self/mountinfo"

or whether I just

mount --bind /sys/fs/cgroup/freezer/$(awk -F: '/freezer/ { print $3 }' /proc/self/cgroup) /mnt

'mount root' field (field 3) in /proc/self/mountinfo will show the
same thing, the result of awk -F: '/freezer/ { print $3 }' /proc/self/cgroup.

I keep waffling between thinking this is a problem that needs to be
solved, and thinking "don't do that".  But docker at least seems to
have a problem with it right now, because it uses that field as part
of its calculation of paths to write to.

So, do you think it would be worth adding a 'nsroot=' entry in the
optional fields (next shared:) ?  I would've just sent a patch, but
it actually isn't quite as simple as it would seem to find a way to
get the absolute path during mountinfo_read(), so I thought I'd ask
before spending more time on it.

thanks,
-serge

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

* Re: cgroup namespaces - mount root
  2016-03-11 21:50 cgroup namespaces - mount root Serge E. Hallyn
@ 2016-03-16 21:46 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2016-03-16 21:46 UTC (permalink / raw)
  To: Serge E. Hallyn; +Cc: lkml, cgroups

Hello, Serge.

On Fri, Mar 11, 2016 at 03:50:10PM -0600, Serge E. Hallyn wrote:
> 'mount root' field (field 3) in /proc/self/mountinfo will show the
> same thing, the result of awk -F: '/freezer/ { print $3 }' /proc/self/cgroup.

I see.

> I keep waffling between thinking this is a problem that needs to be
> solved, and thinking "don't do that".  But docker at least seems to
> have a problem with it right now, because it uses that field as part
> of its calculation of paths to write to.

Yeah, given that both are used in pretty simliar context, I think
distinguishing them would be a good idea.

> So, do you think it would be worth adding a 'nsroot=' entry in the
> optional fields (next shared:) ?  I would've just sent a patch, but

Yeah, I think so.

> it actually isn't quite as simple as it would seem to find a way to
> get the absolute path during mountinfo_read(), so I thought I'd ask
> before spending more time on it.

Thanks.

-- 
tejun

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

end of thread, other threads:[~2016-03-16 21:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-11 21:50 cgroup namespaces - mount root Serge E. Hallyn
2016-03-16 21:46 ` Tejun Heo

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

all inboxes | Powered by JetHome®