[Devel] [PATCH hci-8.1 1/2] Revert "ve/vtty: fix console attach failing with EBUSY while the CT closes the tty"

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


From: Denis V. Lunev <den at openvz.org>

This reverts commit 17cb7be7bfa3.

Returning -EAGAIN for a pair the CT is still closing helps only a vzctl
which retries. Every installed vzctl tries VE_CONFIGURE_OPEN_TTY once
and now fails with

  Error opening CT tty: Resource temporarily unavailable

instead of "Device or resource busy". The next patch waits for the
closing pair inside vtty_open_master() instead, which needs no
userspace change.

https://virtuozzo.atlassian.net/browse/VSTOR-152365
Feature: tty: virtual Container console
Signed-off-by: Denis V. Lunev <den at openvz.org>
---
 drivers/tty/pty.c                           | 5 ++---
 tools/testing/selftests/ve/ve_vtty_stress.c | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 6f6dabba96e2..14d46bb9c293 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -1100,15 +1100,14 @@ int vtty_open_master(envid_t veid, int idx)
 	 * user is gone and tty_release() has already committed to the final
 	 * close, release_tty() is only waiting for tty_mutex to free it.
 	 * Never hand out a reference to a tty which is about to be freed,
-	 * report -EAGAIN so that the caller retries and allocates a fresh
-	 * pair. -EBUSY above means a console is really attached.
+	 * report -EBUSY so that the next attempt allocates a fresh pair.
 	 *
 	 * A pair we've just created above is exempt: it is not reachable by
 	 * anyone else yet and its zero count is merely the initial state,
 	 * vtty_install() gives its reference away to the master peer below.
 	 */
 	if (!created && slave->count == 0) {
-		ret = -EAGAIN;
+		ret = -EBUSY;
 		goto err_unlock;
 	}
 
diff --git a/tools/testing/selftests/ve/ve_vtty_stress.c b/tools/testing/selftests/ve/ve_vtty_stress.c
index d8d92ae54718..f4bdd81133b8 100644
--- a/tools/testing/selftests/ve/ve_vtty_stress.c
+++ b/tools/testing/selftests/ve/ve_vtty_stress.c
@@ -44,7 +44,7 @@
  */
 static bool expected_errno(int err)
 {
-	return err == EAGAIN || err == EBUSY || err == EIO || err == ENXIO;
+	return err == EBUSY || err == EIO || err == ENXIO;
 }
 
 /* A runner timeout must still reach the cleanup */
-- 
2.53.0



More information about the Devel mailing list