pty.c: tty_lock() and tty_unlock() in reverse order?

From: Eli Billauer
Date: Fri Oct 29 2010 - 13:38:39 EST


Hello,


After having some problems with a simple open of /dev/tty taking 30 seconds or so (more precisely, a complete freeze of login console and very slow ssh), I looked a bit into the kernel code.


My very recently downloaded kernel.org 2.6.36's pty.c goes as below. What bothers me is that tty_unlock() is called first, and tty_lock() just before exiting. Shouldn't it be the other way around?


static void pty_close(struct tty_struct *tty, struct file *filp)
{


[snipped some code here, no games with locks]

tty_*un*lock();
tty_vhangup(tty->link);
tty_lock();
}
}


Eli

--
Web: http://www.billauer.co.il

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/