Re: strange delays on console logouts (tty != 1)

From: Chris Wedgwood
Date: Sat May 01 2004 - 18:47:17 EST


On Sun, May 02, 2004 at 01:24:48AM +0200, Petr Vandrovec wrote:

> I do not think that it is init...

No, it's not.

> (1) agetty (at least from util-linux 2.12 from current debian
> unstable) opens /dev/console and calls VT_OPENQRY to find first
> unopened VT.

yes, this i discovered too

> I have no idea why it does this, especially as it causes problems
> when more than one agetty is started simultaneously. I cannot
> believe that there is no better way how to detect whether tty is in
> use or not (as comment in the agetty suggests).

read below

> (2) tty hangup is scheduled for work_queue.

> (3) when you have bad luck then scheduled hangup work runs AFTER
> newly created agetty calls VT_OPENQRY, and you get an error that
> ttyX is already in use...

Unless I misunderstand you, I'm not conviced... it get tty's 'stuck',
they never come right even after hours or days.

> I think that we should concentrate on how is it possible that init
> can spawn agetty and agetty can parse whole /var/run/utmp, open
> /dev/console and issue VT_OPENQRY before work scheduled before init
> was even notified is done. It looks to me like that someone
> schedules some job on the workqueue although that job apparently
> deserves its own kernel thread due to time it takes.

Yes, as far as the kernel is concerned this needs checking.

By comments (from before I got this email) and a pointer to the fix I
use...


I see unused tty's (such as tty4) and ioctl(..., VT_OPENQRY, ...)
returning numbers like 8 --- which agetty barfs on.

The solution I hacked up was to have agetty use vhangup on the tty and
not even use the ioctl which seems fragile at the best of time. The
present patch is at:

http://stupidest.org/patches/util-linux-2.12-agetty-vhangup.001.patch

(ugly URL, sorry about that).

I've cc'd Andries Brouwer his his comments as he is the util-linux
maintainer.



Thanks,

--cw
-
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/