[Devel] [VZ10 v2 16/21] ve/tty: Use vtty_alloc_tty_struct only when CONFIG_VE

Vladimir Riabchun vladimir.riabchun at virtuozzo.com
Fri May 15 23:01:56 MSK 2026


vtty_alloc_tty_struct is defined only with CONFIG_VE,
but its usage in alloc_tty_struct was is covered by
this guard.

Add this guard and return original tty_set_lock_subclass
call in vtty_open_master when !CONFIG_VE to keep original
lockdep behavior.

https://virtuozzo.atlassian.net/browse/VSTOR-130116

Feature: !CONFIG_VE build
Fixes: a35101ad1bc3 ("vtty: fix slave peer lockdep annotation")
Signed-off-by: Vladimir Riabchun <vladimir.riabchun at virtuozzo.com>
---
v1 -> v2:
 - Rework patch so that a35101ad1bc3 ("vtty: fix slave peer
   lockdep annotation") is effectively reverted when !CONFIG_VE
 - Add commit description

 drivers/tty/pty.c    | 3 +++
 drivers/tty/tty_io.c | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index bbf569973945..f8610c77817a 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -1070,6 +1070,9 @@ int vtty_open_master(envid_t veid, int idx)
 		}
 		tty->count--;
 		tty_unlock(tty);
+#ifndef CONFIG_VE
+		tty_set_lock_subclass(tty);
+#endif
 		tty = tty->link;
 	}
 
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 0d1e4ffe2bec..c40996ff7988 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -3213,7 +3213,7 @@ struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx)
 	tty_line_name(driver, idx, tty->name);
 	tty->dev = tty_get_device(tty);
 
-#ifdef CONFIG_TTY
+#if defined(CONFIG_TTY) && defined(CONFIG_VE)
 	vtty_alloc_tty_struct(driver, tty);
 #endif
 	return tty;
-- 
2.43.0



More information about the Devel mailing list