On Wed, Nov 18, 2015 at 04:16:07PM +0300, Cyrill Gorcunov wrote:
> In pcs6 the pty counting has been somewhat sophisticated so in
> pcs7 we've simplified it to bring as less changes into vanilla
> code as possible (introducing TTY_PINNED_BY_OTHER bit to order
> closing sequence). The new accounting works as expected but
> there is a small issue -- until master peer get a real user hooked
> on it (say containers opens /dev/console on its own and writes
> log into it) any write operation return -EIO because line
> discipline module tests the @count on the other side of a peer.
> 
> I think we can add one small code snippet (just the same
> as we did in tty_release() helper to track such situation
> and allow to write into sole open vtty.

Agree.

> 
> Basically the issue were that getty inside container wrote
> some data upon container's starup and connection from the
> node simply didn't get it because data was lost which as
> a side effect forced a console user to hit "enter" second
> time.
> 
> https://jira.sw.ru/browse/PSBM-40740
> 
> Signed-off-by: Cyrill Gorcunov <[email protected]>
> CC: Vladimir Davydov <[email protected]>
> CC: Konstantin Khorenko <[email protected]>
> CC: Igor Sukhih <[email protected]>
> CC: Nikolay Breykin <[email protected]>
> ---
>  drivers/tty/n_tty.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> Index: linux-pcs7.git/drivers/tty/n_tty.c
> ===================================================================
> --- linux-pcs7.git.orig/drivers/tty/n_tty.c
> +++ linux-pcs7.git/drivers/tty/n_tty.c
> @@ -2041,7 +2041,13 @@ static ssize_t n_tty_write(struct tty_st
>                       retval = -ERESTARTSYS;
>                       break;
>               }
> +#ifdef CONFIG_VE
> +             if (tty_hung_up_p(file) ||
> +                 (tty->link && !tty->link->count &&
> +                  !(test_bit(TTY_PINNED_BY_OTHER, &tty->link->flags)))) {
> +#else
>               if (tty_hung_up_p(file) || (tty->link && !tty->link->count)) {
> +#endif

I wouldn't surround TTY_PINNED_BY_OTHER with CONFIG_VE here and there,
but I see that you do it so as to track our changes easier. Well, I
think, git log suits the purpose better, but it isn't worth arguing
upon, so

Reviewed-by: Vladimir Davydov <[email protected]>

>                       retval = -EIO;
>                       break;
>               }
> 
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to