Re: [Patch] 2.4.28-pre3 tty/ldisc fixes

From: Sergey Vlasov
Date: Sun Nov 07 2004 - 15:09:34 EST


On Tue, Nov 02, 2004 at 10:02:44AM -0500, Jason Baron wrote:
>
> On Sun, 31 Oct 2004, Krzysztof Taraszka wrote:
>
> > Dnia sobota, 30 pa?dziernika 2004 21:19, napisa?e?:
> > > On Fri, Oct 29, 2004 at 02:29:43PM -0400, Jason Baron wrote:
> >
> > > > Here's an updated 2.4 tty patch. I'm not sure if the updated patch would
> > > > fix the above issue, but it has a lot of changes so it might be worth a
> > > > try.
> > >
> > > This looks better - at least the system boots without hang or oops ;)
> >
> > where is an updated 2.4 tty patch ?
>
> hmmm...seems like my e-mails keeping getting dropped, perhaps the patch is
> too large? Here is a link to the patch:
>
> http://people.redhat.com/~jbaron/tty/2.4-tty-V5.patch

Finally I have found the bug which prevented SieFS (slink) from
working. The bug was in drivers/char/tty_ioctl.c:

@@ -131,16 +141,20 @@ static void change_termios(struct tty_st
}
}

- if (tty->driver.set_termios)
- (*tty->driver.set_termios)(tty, &old_termios);
+ ld = tty_ldisc_ref(tty);
+ if (ld != NULL) {
+ if (ld->set_termios)
+ (ld->set_termios)(tty, &old_termios);
+ tty_ldisc_deref(ld);
+ }
+ spin_unlock_irqrestore(&tty_termios_lock, flags);

- if (tty->ldisc.set_termios)
- (*tty->ldisc.set_termios)(tty, &old_termios);
}

The call to tty->driver.set_termios was lost, therefore the serial
port speed was not set properly.

Simply adding this call back does not work, because set_termios
handlers in usbserial use semaphores for locking, and therefore cannot
be called while holding the tty_termios_lock spinlock. Because of
this, some more backporting from 2.6.x is needed - Alan Cox has
already changed tty_termios_lock to a per-tty semaphore in 2.6.x, this
change is needed for 2.4.x too.

The patches are in separate emails: first is the backport of the
termios locking changes, second patch adds back lost call to
tty->driver.set_termios (which is safe after first patch).

Attachment: pgp00000.pgp
Description: PGP signature