Re: [PATCH] vt: kill tty->count usage (v2)

From: Aristeu Rozanski
Date: Tue Aug 19 2008 - 13:04:24 EST


Hi Alan,
> > > > The commit e0426e6a09954d205da2d674a3d368d2715e3afd fixes a real race but
> > > > still isn't enough to prevent these:
> > > >
> > > > kobject_add_internal failed for vcs7 with -EEXIST, don't try to register
> > > > things with the same name in the same direc.
> > >
> > > Patch dropped due to testing failures.
> > >
> > > Boot to run level 3, log in and type "reboot\n". Wait
> > >
> > > Spews vt->driver_data == NULL warnings and oopses
> > do you mind posting the logs somewhere? I wasn't able to reproduce it here so
>
> I decided it might be better to tackle this one 'head on' and go to the
> root of the problem. I've pushed the following into the stack of patches
> for -next
>
> tty: shutdown method
I agree with the idea, but:

> /**
> * release_one_tty - release tty structure memory
> * @kref: kref of tty we are obliterating
> @@ -1489,27 +1514,11 @@ static void release_one_tty(struct kref *kref)
> {
> struct tty_struct *tty = container_of(kref, struct tty_struct, kref);
> struct tty_driver *driver = tty->driver;
> - int devpts = tty->driver->flags & TTY_DRIVER_DEVPTS_MEM;
> - struct ktermios *tp;
> - int idx = tty->index;
> -
> - if (!devpts)
> - tty->driver->ttys[idx] = NULL;
> -
> - if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) {
> - /* FIXME: Locking on ->termios array */
> - tp = tty->termios;
> - if (!devpts)
> - tty->driver->termios[idx] = NULL;
> - kfree(tp);
> -
> - tp = tty->termios_locked;
> - if (!devpts)
> - tty->driver->termios_locked[idx] = NULL;
> - kfree(tp);
> - }
> -
>
> + if (tty->ops->shutdown)
> + tty->ops->shutdown(tty);
> + else
> + tty_shutdown(tty);
> tty->magic = 0;
> /* FIXME: locking on tty->driver->refcount */
> tty->driver->refcount--;
isn't too late for drivers that wait for the remaining data to be transmitted
such as amiserial and cyclades? Unless there's a plan to do it at
release_dev()?

--
Aristeu

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