login prompt of tty2~6 displayed slowly
Hi, all
I have a trouble on tty of -next.
After the system booted and login prompt of tty1 was displayed, I tried to change tty1 to tty2 or other console with Ctrl+Alt+FN(N:2~6). The changed screen was black and there was not login prompt. After a few(2~3) minutes the prompt was displayed. I checked the message of klog and there were some errors of tty listed as following:
Sep 15 10:02:44 iridium /sbin/mingetty[3062]: tty2: cannot open tty: Input/output error Sep 15 10:02:44 iridium /sbin/mingetty[3063]: tty3: cannot open tty: Input/output error Sep 15 10:02:44 iridium /sbin/mingetty[3060]: tty4: cannot open tty: Input/output error Sep 15 10:02:44 iridium /sbin/mingetty[3061]: tty5: cannot open tty: Input/output error Sep 15 10:02:44 iridium /sbin/mingetty[3066]: tty6: cannot open tty: Input/output error Sep 15 10:02:49 iridium init: tty2 main process (3062) terminated with status 1 Sep 15 10:02:49 iridium init: tty2 main process ended, respawning Sep 15 10:02:49 iridium init: tty3 main process (3063) terminated with status 1 Sep 15 10:02:49 iridium init: tty3 main process ended, respawning Sep 15 10:02:49 iridium /sbin/mingetty[3107]: tty3: cannot open tty: Input/output error Sep 15 10:02:49 iridium init: tty4 main process (3060) terminated with status 1 Sep 15 10:02:49 iridium init: tty4 main process ended, respawning Sep 15 10:02:49 iridium /sbin/mingetty[3106]: tty2: cannot open tty: Input/output error Sep 15 10:02:49 iridium /sbin/mingetty[3108]: tty4: cannot open tty: Input/output error Sep 15 10:02:49 iridium init: tty5 main process (3061) terminated with status 1 Sep 15 10:02:49 iridium init: tty5 main process ended, respawning Sep 15 10:02:49 iridium /sbin/mingetty[3109]: tty5: cannot open tty: Input/output error Sep 15 10:02:49 iridium init: tty6 main process (3066) terminated with status 1 Sep 15 10:02:49 iridium init: tty6 main process ended, respawning Sep 15 10:02:49 iridium /sbin/mingetty[3110]: tty6: cannot open tty: Input/output error
And I find out that the root cause of this problem is the following patch:
commit 236cce0066f9c6a4856bc0404e541d3db3b0255e
Titled "tty: make the kref destructor occur asynchronously"
When the tty is closed, the content of tty is not released immediately. And the flag of tty is set with TTY_CLOSING. So when the tty is reopened, the tty may not be released yet. Because the TTY_CLOSING in flag of tty is still valid. The kernel returns "-EIO" error. And the message
"/sbin/mingetty[3062]: tty2: cannot open tty: Input/output error"
is displayed at the user land.
Best Regards
Jin Dongming
Quoted 3 lines
And I find out that the root cause of this problem is the following
patch: commit236cce0066f9c6a4856bc0404e541d3db3b0255e
Titled "tty: make the kref destructor occur asynchronously"
Technically its a bug in mingetty but in practical terms its a regression and the new behaviour isn't nice at all.
Quoted 6 lines
When the tty is closed, the content of tty is not released immediately. And the flag of tty is set with
TTY_CLOSING. So when the tty is reopened, the tty may not be released yet. Because theTTY_CLOSINGin flag of tty is still valid. The kernel returns "-EIO" error. And the message "/sbin/mingetty[3062]: tty2: cannot open tty:
Input/output error" is displayed at the user land.
See the previous discussions on how to fix this. I'm not sure if anyone has addressed them yet but basically the shutdown and async destructor need to be split apart so the device is deregistered synchronously and then destroyed asynchronously