• J
    [PATCH] uml: console locking fixes · d79a5809
    Jeff Dike 提交于
    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: NJeff Dike <jdike@addtoit.com>
    Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    d79a5809
stdio_console.c 4.7 KB