Skip to contentSkip to conversation

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

DISCUSSION Eli Billauer 1 participant 1 message Oct 29, 2010

lore
Share & tools
lore
#0 lore raw

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

Signature · 1 line
Web: http://www.billauer.co.il