From: "Yuriy M. Kaminskiy" <yumkam@gmail.com>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux@vger.kernel.org
Subject: Re: unshare -m and mount propagation
Date: Mon, 18 Apr 2016 23:35:36 +0300 [thread overview]
Message-ID: <57154518.2040700@gmail.com> (raw)
In-Reply-To: <20160418174833.qwb7tnfzuf3wiokw@ws.net.home>
On 18.04.2016 20:48, Karel Zak wrote:
> On Mon, Apr 18, 2016 at 04:05:29PM +0300, Yuriy M. Kaminskiy wrote:
>> On 18.04.2016 15:22, Karel Zak wrote:
>>> On Mon, Apr 18, 2016 at 02:51:37PM +0300, Yuriy M. Kaminskiy wrote:
>>>> Karel Zak <kzak@redhat.com> writes:
>>>>
>>>>> On Fri, Mar 18, 2016 at 05:26:25AM +0300, Yuriy M. Kaminskiy wrote:
>>>>>> I think this issue should be at least documented. And, maybe, default
>>>>>> `--propagation` should be changed to `slave`.
>>>>>
>>>>> The reason why we use 'private' is that it's the kernel default for
>>>>> years and it's what has been expected by users for long time before we
>>>>> introduced --propagation and any unshare(1) default.
>>>>>
>>>>> The current --propagation default unifies things and makes unshare(1)
>>>>> portable to distributions where root fs is mounted as 'shared' (e.g.
>>>>> systemd distros) and all this in backwardly compatible way for users
>>
>> Opposite. It does not change anything for older systems, but breaks things
>> for new systems.
>>
>>>>> who have no clue about --propagation.
>>
>> And it is *especially* harmful for users that are not aware about
>> --propagation. As private (new 2.27+ default) break umount propagation, and
>> results in nasty surprises (up to data loss).
>
> Well, you see only umount propagation...
Because *breaking* it causes real problems?
> The problem is that the original implementation (try emulate by
> "--propagation unchanged") makes "unshare --mount" useless at all on
> systems with shared root fs.
>
> The very old (since year 2009) and very common use-case is:
>
> # unshare --mount
mount --make-rslave / # or --make-rprivate or whatever
> # mount /dev/foo /mnt
And? I've posted how this could be solved *without* changing anything in
unshare.
> and user expects that /mnt will be visible *only* in the session
> (namespace). This is the way how many users use unshare for years.
>
> Unfortunately, after systemd installation it does not work anymore
> and /mnt is visible everywhere. For users it's regression and it has
> been reported many many times.
>
> You can blame systemd, but the problem is that unshare(1) was not
> robust enough. So we have forced unshare to use "private" by default
> to keep the *original behavior* independently on root fs propagation
> flag.
You can have same effect with *slave* as default, with exception that
host->guest mount/unmount propagation still works.
When kernel have to get rid of shared propagation (in userns), it
downgrades shared mounts to *slave*, not to *private*.
When systemd itself downgrades shared propagation (for running service
in new mount namespace; Protect*/Private*/etc), it also downgrades
*shared* propagation to *slave*, not to *private*.
P.S. For sure, *any* of propagation variants have some or other
drawbacks and corner cases; however, without special care about
removable media (and alike), *private* has higher chance to beat you in
a nasty way.
prev parent reply other threads:[~2016-04-18 20:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-18 2:26 unshare -m and mount propagation Yuriy M. Kaminskiy
2016-04-18 11:16 ` Karel Zak
2016-04-18 11:51 ` Yuriy M. Kaminskiy
2016-04-18 12:22 ` Karel Zak
2016-04-18 13:05 ` Yuriy M. Kaminskiy
2016-04-18 17:48 ` Karel Zak
2016-04-18 20:35 ` Yuriy M. Kaminskiy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57154518.2040700@gmail.com \
--to=yumkam@gmail.com \
--cc=kzak@redhat.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.