Re: Linux-2.2.2-pre2..

Andrea Arcangeli (andrea@e-mind.com)
Sun, 7 Feb 1999 20:56:54 +0100 (CET)


On Sun, 7 Feb 1999, Andrea Arcangeli wrote:

>Supposing that I am right, I don't know if do_tty_hangup() is supposed to
>be run only from release_dev() and so I don't know if the real bug that is

Now I am forcing the kernel to run as in the case it wasn't racing.
Basically now when a master pty hangup it will put its do_tty_hangup
request in the new tq_tty_hangup task queue. Then when the _last_ slave
will hangup too the do_tty_hangup() of the master will run a bit before
releasing the tty struct memory.

I left the run_task_queue(&tq_scheduler) because I seen many tty lowlevel
drivers that are using it (just to be safe before removing the struct
under their eyes).

Works fine here.

Index: drivers/char//tty_io.c
===================================================================
RCS file: /var/cvs/linux/drivers/char/tty_io.c,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 tty_io.c
--- tty_io.c 1999/01/31 22:44:47 1.1.2.4
+++ linux/drivers/char/tty_io.c 1999/02/07 19:48:18
@@ -54,6 +54,9 @@
*
* Added support for a Unix98-style ptmx device.
* -- C. Scott Ananian <cananian@alumni.princeton.edu>, 14-Jan-1998
+ *
+ * tq_tty_hangup
+ * -- Andrea Arcangeli, 7-Feb-1999
*/

#include <linux/config.h>
@@ -115,6 +118,8 @@
*/
struct tty_struct * redirect = NULL;

+static DECLARE_TASK_QUEUE(tq_tty_hangup);
+
static void initialize_tty_struct(struct tty_struct *tty);

static ssize_t tty_read(struct file *, char *, size_t, loff_t *);
@@ -491,7 +496,7 @@

printk("%s hangup...\n", tty_name(tty, buf));
#endif
- queue_task(&tty->tq_hangup, &tq_scheduler);
+ queue_task(&tty->tq_hangup, &tq_tty_hangup);
}

void tty_vhangup(struct tty_struct * tty)
@@ -1208,6 +1213,7 @@
*/
run_task_queue(&tq_timer);
run_task_queue(&tq_scheduler);
+ run_task_queue(&tq_tty_hangup);

/*
* The release_mem function takes care of the details of clearing

Andrea Arcangeli

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/