[Devel] [PATCH hci-8.1 0/2] ve/vtty: wait for a closing CT tty in the kernel, drop the EAGAIN return

Denis V. Lunev den at openvz.org
Mon Nov 2 20:15:02 MSK 2026


Konstantin pointed out that the applied "ve/vtty: fix console attach
failing with EBUSY while the CT closes the tty" fixes the race only
for a vzctl which retries on EAGAIN, and every vzctl in the field
does not. Following his suggestion, this series replaces it with a
wait inside vtty_open_master(), as tty_open() does since
7f22f6c935cd. Patch 1 reverts the EAGAIN return, patch 2 waits for
the closing pair. The vzctl change "vzctl console: retry opening a
CT tty the CT is still closing" is no longer needed.

A signal ends the wait with -ERESTARTSYS rather than -EAGAIN: the
ioctl restarts under SA_RESTART and fails with EINTR otherwise, and
EAGAIN does not leak back to userspace.

Tested on dev-cl04, .22.15 with both patches, installed vzctl-10.0.147
which does not retry:
- "vzctl console" in a loop while a loop in the CT opens and closes the
  same tty: 63 of 300 attaches fail with EBUSY on stock .22.11, all 300
  attach with the series;
- a second VE_CONFIGURE_OPEN_TTY while a console is attached still
  fails with EBUSY at once;
- the same race under a 50 us SIGALRM storm does not hang: the
  interrupted opens fail with EINTR, and with SA_RESTART none fail;
- ve_vtty_stress, without its EAGAIN allowance, passes;
- nothing in dmesg.

Denis V. Lunev (2):
  Revert "ve/vtty: fix console attach failing with EBUSY while the CT
    closes the tty"
  ve/vtty: wait for a closing CT tty instead of failing the console
    attach

 drivers/tty/pty.c                           | 16 ++++++++++++----
 tools/testing/selftests/ve/ve_vtty_stress.c |  2 +-
 2 files changed, 13 insertions(+), 5 deletions(-)

-- 
2.53.0



More information about the Devel mailing list