diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-02-10 04:43:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-11 13:51:21 -0500 |
commit | d79a580936396bbcd2f4fae2c6215f9cf81e3c0d (patch) | |
tree | 72c91c7475e2562c5459c4d6d0499cdd671e0b50 /arch/um/drivers/stdio_console.c | |
parent | 5cf885d01f30be710a339976c485f92bb8a8946d (diff) |
[PATCH] uml: console locking fixes
Clean up the console driver locking. There are various problems here,
including sleeping under a spinlock and spinlock recursion, some of which are
fixed here. This patch deals with the locking involved with opens and closes.
The problem is that an mconsole request to change a console's configuration
can race with an open. Changing a configuration should only be done when a
console isn't opened. Also, an open must be looking at a stable
configuration. In addition, a get configuration request must observe the same
locking since it must also see a stable configuration. With the old locking,
it was possible for this to hang indefinitely in some cases because open would
block for a long time waiting for a connection from the host while holding the
lock needed by the mconsole request.
As explained in the long comment, this is fixed by adding a spinlock for the
use count and configuration and a mutex for the actual open and close.
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/drivers/stdio_console.c')
-rw-r--r-- | arch/um/drivers/stdio_console.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c index 7a4897e27f42..9b2dd0b8a43b 100644 --- a/arch/um/drivers/stdio_console.c +++ b/arch/um/drivers/stdio_console.c | |||
@@ -83,9 +83,9 @@ static struct lines console_lines = LINES_INIT(MAX_TTYS); | |||
83 | /* The array is initialized by line_init, which is an initcall. The | 83 | /* The array is initialized by line_init, which is an initcall. The |
84 | * individual elements are protected by individual semaphores. | 84 | * individual elements are protected by individual semaphores. |
85 | */ | 85 | */ |
86 | struct line vts[MAX_TTYS] = { LINE_INIT(CONFIG_CON_ZERO_CHAN, &driver), | 86 | static struct line vts[MAX_TTYS] = { LINE_INIT(CONFIG_CON_ZERO_CHAN, &driver), |
87 | [ 1 ... MAX_TTYS - 1 ] = | 87 | [ 1 ... MAX_TTYS - 1 ] = |
88 | LINE_INIT(CONFIG_CON_CHAN, &driver) }; | 88 | LINE_INIT(CONFIG_CON_CHAN, &driver) }; |
89 | 89 | ||
90 | static int con_config(char *str) | 90 | static int con_config(char *str) |
91 | { | 91 | { |