lkml.org 
[lkml]   [2009]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] kdesu broken


On Wed, 29 Jul 2009, Alan Cox wrote:

> > The tty_ldisc_hangup() already does tty_ldisc_wait_idle() after disabling
> > the timer (and clearing the TTY_LDISC bit), so that all seems fine
> > already. No?
>
> We only do tty_ldisc_wait_idle if tty->driver->flags & TTY_RESET_TERMIOS
> is set that I can see ?

I agree, but that's also the only time we do that 'tty_ldisc_halt()' that
cancels the timer. So if there is something that depends on the
flush_to_ldisc() not happening, the bug was pre-existing since it never
got rid of the flush to begin with, so the flush_to_ldisc() would happen
at some random later time as a result of the delayed-work timer.

That said, I suspect that from a sanity standpoint, I suspect something
like the appended migth be a good idea. But I think it's an independent
issue (and unless somebody can actually point to an actual problem, I'd
only apply something like this during the merge window, not after -rc4).

Linus
---
drivers/char/tty_ldisc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c
index acd76b7..640b100 100644
--- a/drivers/char/tty_ldisc.c
+++ b/drivers/char/tty_ldisc.c
@@ -778,6 +778,8 @@ void tty_ldisc_hangup(struct tty_struct *tty)
if (ld->ops->hangup)
ld->ops->hangup(tty);
tty_ldisc_deref(ld);
+ tty_ldisc_halt(tty);
+ tty_ldisc_wait_idle(tty);
}
/*
* FIXME: Once we trust the LDISC code better we can wait here for
@@ -794,8 +796,6 @@ void tty_ldisc_hangup(struct tty_struct *tty)
mutex_lock(&tty->ldisc_mutex);
if (tty->ldisc) { /* Not yet closed */
/* Switch back to N_TTY */
- tty_ldisc_halt(tty);
- tty_ldisc_wait_idle(tty);
tty_ldisc_reinit(tty);
/* At this point we have a closed ldisc and we want to
reopen it. We could defer this to the next open but

\
 
 \ /
  Last update: 2009-10-18 23:28    [from the cache]
©2003-2011 Jasper Spaans