From: Dave Young <hidave.darkstar@gmail.com>
To: Emmanuel Benisty <benisty.e@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Greg KH <greg@kroah.com>, Alan Cox <alan@lxorguk.ukuu.org.uk>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: mmotm 2009-08-06-00-30 uploaded
Date: Fri, 14 Aug 2009 10:55:50 +0800 [thread overview]
Message-ID: <a8e1da0908131955w6d740be2nfdbaacbe23ca51a@mail.gmail.com> (raw)
In-Reply-To: <c1f41c620908130802x77886b15p766af4be070191cd@mail.gmail.com>
On Thu, Aug 13, 2009 at 11:02 PM, Emmanuel Benisty<benisty.e@gmail.com> wrote:
> On Wed, Aug 12, 2009 at 6:48 AM, Dave Young<hidave.darkstar@gmail.com> wrote:
>> On Tue, Aug 11, 2009 at 10:08:24PM +0800, Dave Young wrote:
>>> On Sat, Aug 08, 2009 at 06:13:53PM +0800, Dave Young wrote:
>>> > On Sat, Aug 8, 2009 at 12:49 AM, Andrew Morton<akpm@linux-foundation.org> wrote:
>>> > > On Fri, 7 Aug 2009 21:47:00 +0800 Dave Young <hidave.darkstar@gmail.com> wrote:
>>> > >
>>> > >> Hi, andrew
>>> > >>
>>> > >> Booting with this release, init (maybe getty?) reports something like:
>>> > >>
>>> > >> INIT: open /dev/console failed with input/output error
>>> > >>
>>> > >> 2.6.31-rc5 is fine.
>>> > >>
>>> > >> Any hints to find the root problem?
>>> > >
>>> > > Not really, sorry. Might be tty changes in linux-next?
>>> >
>>> > I bisected linux-next, find following patch as a result
>>> >
>>> > commit 65b8c7d9be5862ff8ac839607b444b6f6b11d2fb
>>> > Author: Alan Cox <alan@linux.intel.com>
>>> > Date: Thu Aug 6 09:58:02 2009 +1000
>>> >
>>> > cyclades: use the full port_close function
>>> >
>>> > But, I did not select cyclades in my .config, nor do i have the hardware. Weird.
>>>
>>> The above result is wrong, it's a mistake.
>>>
>>> After a whole day's testing and debugging with linux-2.6 git tree and tty patch series, I found the patch causing this issue.
>>> --
>>> From: Alan Cox <alan@linux.intel.com>
>>> Subject: tty: make the kref destructor occur asynchronously
>>> --
>>>
>>> If we make the tty release in a work queue, then tty_reopen might fail with -EIO. I read the sysvinit source code, it will retry 5 times, if still failed, it will warning, then no output before login.
>>>
>>> My distribution is slackware 12.2
>>>
>>> I tested with following debug patch.
>>>
>>> --- linux-2.6.orig/drivers/char/tty_io.c 2009-08-11 21:29:03.000000000 +0800
>>> +++ linux-2.6/drivers/char/tty_io.c 2009-08-11 21:40:01.000000000 +0800
>>> @@ -1246,8 +1246,10 @@ static int tty_reopen(struct tty_struct
>>> {
>>> struct tty_driver *driver = tty->driver;
>>>
>>> - if (test_bit(TTY_CLOSING, &tty->flags))
>>> + if (test_bit(TTY_CLOSING, &tty->flags)) {
>>> + printk(KERN_INFO "tty_io.c: closing\n");
>>> return -EIO;
>>> + }
>>>
>>> if (driver->type == TTY_DRIVER_TYPE_PTY &&
>>> driver->subtype == PTY_TYPE_MASTER) {
>>> @@ -1255,8 +1257,10 @@ static int tty_reopen(struct tty_struct
>>> * special case for PTY masters: only one open permitted,
>>> * and the slave side open count is incremented as well.
>>> */
>>> - if (tty->count)
>>> + if (tty->count) {
>>> + printk(KERN_INFO "tty_io.c: open count %d\n", tty->count);
>>> return -EIO;
>>> + }
>>>
>>> tty->link->count++;
>>> }
>>> @@ -1705,6 +1709,7 @@ static int __tty_open(struct inode *inod
>>> int index;
>>> dev_t device = inode->i_rdev;
>>> unsigned saved_flags = filp->f_flags;
>>> + static int t;
>>>
>>> nonseekable_open(inode, filp);
>>>
>>> @@ -1778,8 +1783,15 @@ got_driver:
>>>
>>> mutex_unlock(&tty_mutex);
>>> tty_driver_kref_put(driver);
>>> - if (IS_ERR(tty))
>>> + if (IS_ERR(tty)) {
>>> + int r = PTR_ERR(tty);
>>> + if (t == 5) {
>>> + printk(KERN_INFO "%s: %d, %d, retval: %d\n", __FILE__, __LINE__, r, retval);
>>> + t =0;
>>> + } else
>>> + t++;
>>> return PTR_ERR(tty);
>>> + }
>>>
>>> filp->private_data = tty;
>>> file_move(filp, &tty->tty_files);
>>>
>>>
>>
>> Here is a fix for that issue, please help to review.
>> --
>>
>> Due to tty release routines runs in workqueue now,
>> error like following will be reported while booting:
>>
>> INIT open /dev/console input/output error
>>
>> Opening a tty while closing not finished is what cause such problem.
>>
>> Fix it by flush hangup_work in such case and then call tty_init_dev.
>>
>>
>> Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
>> --
>> drivers/char/tty_io.c | 11 ++++++++---
>> 1 file changed, 8 insertions(+), 3 deletions(-)
>>
>> --- linux-2.6.orig/drivers/char/tty_io.c 2009-08-12 07:12:31.000000000 +0800
>> +++ linux-2.6/drivers/char/tty_io.c 2009-08-12 07:31:30.000000000 +0800
>> @@ -1770,9 +1770,14 @@ got_driver:
>> }
>>
>> if (tty) {
>> - retval = tty_reopen(tty);
>> - if (retval)
>> - tty = ERR_PTR(retval);
>> + if (test_bit(TTY_CLOSING, &tty->flags)) {
>> + flush_work(&tty->hangup_work);
>> + tty = tty_init_dev(driver, index, 0);
>> + } else {
>> + retval = tty_reopen(tty);
>> + if (retval)
>> + tty = ERR_PTR(retval);
>> + }
>> } else
>> tty = tty_init_dev(driver, index, 0);
>>
>
> Thanks Dave, I had the very same issue and your patch fixed it.
>
FIne, so I'm not the only person who have such problem. Thank you for testing.
--
Regards
dave
prev parent reply other threads:[~2009-08-14 2:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-06 7:33 akpm
2009-08-06 8:23 ` KAMEZAWA Hiroyuki
2009-08-06 8:31 ` Andrew Morton
2009-08-07 1:10 ` Dave Young
2009-08-07 2:02 ` mmotm 2009-08-06-00-30 uploaded (mtd) Randy Dunlap
2009-08-07 2:25 ` Andrew Morton
2009-08-07 3:34 ` Paul Mundt
2009-08-07 4:00 ` Randy Dunlap
2009-08-10 7:01 ` Artem Bityutskiy
2009-08-07 13:47 ` mmotm 2009-08-06-00-30 uploaded Dave Young
2009-08-07 13:49 ` Dave Young
2009-08-07 16:49 ` Andrew Morton
2009-08-08 1:59 ` Dave Young
2009-08-08 10:13 ` Dave Young
2009-08-11 14:08 ` Dave Young
2009-08-11 18:30 ` Greg KH
2009-08-11 23:48 ` Dave Young
[not found] ` <c1f41c620908130802x77886b15p766af4be070191cd@mail.gmail.com>
2009-08-14 2:55 ` Dave Young [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a8e1da0908131955w6d740be2nfdbaacbe23ca51a@mail.gmail.com \
--to=hidave.darkstar@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=benisty.e@gmail.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®