Re: [PATCH 14/16] vfs: Implement mount_super_once

From: H. Peter Anvin
Date: Tue Apr 19 2016 - 21:44:44 EST


On April 19, 2016 6:24:12 PM PDT, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>On Tue, Apr 19, 2016 at 4:29 PM, Linus Torvalds
><torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>>
>> I _violently_ oppose the stupid DEVPTS_MULTIPLE_INSTANCES config
>option.
>
>So just to show what I want to actually happen, here's the hacky patch
>on top of my (now merged) cleanup patch that actually does what I want
>devpts to do.
>
>I say it's hacky, because the "follow_mount()" thing there really is
>pretty hacky. Al - suggestions for how to do this *right*?
>
>But this actually forcibly removes the whole "newinstance" thing, and
>makes every pts mount a new instance, and just relies on "ptmx" doing
>the right thing.
>
>In other words, with this patch, you can *literally* do just this (as
>root, obviously):
>
> mkdir test-dir
> cd test-dir
>
> mknod ptmx c 5 2
> mkdir pts
> mount -t devpts pts pts
>
>and after that it all just works. You can do this:
>
> ls -l pts
>
>which shows just the other ptmx noode (that is unused and pointless -
>I'd actually like to just remove it, but whatever), and then you can
>do
>
> sleep 100 < ptmx &
> sleep 100 < ptmx &
> ls -l pts
>
>and you will magically see those new 0/1 entries in that pts
>subdirectory.. It's entirely independent of /dev/pts/, and there's no
>magic connection or any magic dis-connection. It all JustWorks(tm).
>
>Note how this works even *outside* of /dev. But it works inside of
>/dev equally well.
>
>Now, a *real* patch would
>
> - solve that "follow_mount()" issue some other way
>
> - not remove the newinstance code immediately (I did it to show that
>even the bootup works with a unmodified distro)
>
> - actually remove the whole "DEVPTS_MULTIPLE_INSTANCES" config option
>
> - I'm not happy with devpts_pty_kill(). I would want to clean that up
>a bit somehow. I think this is at least partly what Peter Hurley was
>talking about. That thing is not pretty.
>
>so this attached patch is by no means meant to be applied as-is. But
>it's meant to show what (a) the new organization allows and (b) what I
>was going for.
>
> Linus

I say let's remove it unless ptmxmode= is specified. That way we don't break people who actually did the symlink thing.
--
Sent from my Android device with K-9 Mail. Please excuse brevity and formatting.