On 12/05/2015 08:21 PM, Cyrill Gorcunov wrote:
When there are several files opened on /dev/console from inside
of a container and noone hooked on master peer, any close called
cause master peer to be freed with TTY_CLOSING bit set. So that
next "vzctl console $ctid $ttynum" call force kernel to allocate
new vtty pair and in result we can't login into the container.

We've woraround master close when there is an active slave assigned
but I miss the scenario when several fd = open(/dev/console) done and
then one calls for close(fd).

Lets test if master peer is about to close while there are still
active slave (and move it into vtty_release helper).

https://jira.sw.ru/browse/PSBM-41985
https://jira.sw.ru/browse/PSBM-41672

Signed-off-by: Cyrill Gorcunov <gorcu...@virtuozzo.com>
CC: Vladimir Davydov <vdavy...@virtuozzo.com>
CC: Konstantin Khorenko <khore...@virtuozzo.com>
---
  drivers/tty/pty.c    |   27 +++++++++++++++++++++++++++
  drivers/tty/tty_io.c |    7 ++-----
  include/linux/ve.h   |    2 ++
  3 files changed, 31 insertions(+), 5 deletions(-)

Index: linux-pcs7.git/drivers/tty/pty.c
===================================================================
--- linux-pcs7.git.orig/drivers/tty/pty.c
+++ linux-pcs7.git/drivers/tty/pty.c
@@ -1259,6 +1259,33 @@ struct tty_driver *vtty_driver(dev_t dev
        return NULL;
  }

+void vtty_release(struct tty_struct *tty, struct tty_struct *o_tty,
+                 int *tty_closing, int *o_tty_closing)
+{
+       lockdep_assert_held(&tty_mutex);
+       int pty_master;

drivers/tty/pty.c: In function 'vtty_release':
drivers/tty/pty.c:1266:2: error: ISO C90 forbids mixed declarations and code 
[-Werror=declaration-after-statement]
  int pty_master;
  ^
cc1: all warnings being treated as errors

Kirill, i'll fix it, so just take a note for the future.

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to