[systemd-devel] Shared root fs by default

Tvrtko Ursulin tvrtko.ursulin at onelan.co.uk
Mon Apr 8 06:08:55 PDT 2013


On Friday 05 April 2013 18:42:20 Lennart Poettering wrote:
> On Fri, 05.04.13 17:27, Tvrtko Ursulin (tvrtko.ursulin at onelan.co.uk) wrote:
> > On Friday 05 April 2013 18:23:35 Lennart Poettering wrote:
> > > On Fri, 05.04.13 17:19, Tvrtko Ursulin (tvrtko.ursulin at onelan.co.uk) 
wrote:
> > > > > Hmm, does this always happen this way, or is the MS_REC flag
> > > > > "sticky"
> > > > > and causes the MNT_DETACH to be recursive?
> > > > > 
> > > > > That looks a bit like a kernel misfeature, no?
> > > > 
> > > > To me it looks like the kernel is working as designed, but perhaps I
> > > > am
> > > > not
> > > > getting what exactly are you asking. You can read all the details in
> > > > about
> > > > shared mounts and event propagation in
> > > > Documentation/filesystems/sharedsubtree.txt.
> > > > 
> > > > Use case described there is that if you clone (bind) a shared tree you
> > > > need to make it a slave to shut down the propagation in the backward
> > > > direction (it's bi-directional for shared trees by default).
> > > 
> > > Well, but in your example you unmounted a bind mount with a child, and
> > > that resulted in the unmounting of the child in the source mount, too --
> > > even though you never asked for that child mount to be unmounted. That's
> > > what your example showed, right?
> > 
> > Yes, but as I said, after a quick glance at kernel docs I got the
> > impression that is what should happen. I could be wrong though. Perhaps
> > we should try and drag into discussion someone who designed this.
> 
> I would have assumed that it would at least fail with EBUSY as long as
> that submount is still there...
> 
> Which wouldn't solve the issue at hand, but at least make it more
> obvious, since you then have to manually unmount the submounts, and then
> would have to think about what you are doing there...

It does fail with -EBUSY with a normal (no detach) umount. So I think it boils 
down to whether detach unmount should propagate back and forth equivalently as 
other (un)mount events. The cleanest concept is that it does, hence it 
reinforced my impression that the kernel operates as designed.

> Maybe the lesson to learn here is that MS_REC is more powerful than
> people would expect, right? Because it duplicates mount points you don't
> have to explicitly know about...

I am not sure, depends if you think the behaviour is correct or not. Either 
way, I would say that the systemd change to make root "rshared" by default was 
a dangerous one (which was proven empirically) the risk of which outweighs 
eventual benefits. I gather you disagree and plan to leave it as it is?

Regards,

Tvrtko



More information about the systemd-devel mailing list