Revert "drivers:tty:pty: Fix a race causing data loss on close"
[sfrench/cifs-2.6.git] / drivers / tty / pty.c
index 8b2797b6ee4417e4fe85050b44747c46f4403004..5e2374580e271395151039b96fd3fbf1d177e884 100644 (file)
@@ -66,8 +66,7 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
        wake_up_interruptible(&tty->link->read_wait);
        wake_up_interruptible(&tty->link->write_wait);
        if (tty->driver->subtype == PTY_TYPE_MASTER) {
-               struct file *f;
-
+               set_bit(TTY_OTHER_CLOSED, &tty->flags);
 #ifdef CONFIG_UNIX98_PTYS
                if (tty->driver == ptm_driver) {
                        mutex_lock(&devpts_mutex);
@@ -76,17 +75,7 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
                        mutex_unlock(&devpts_mutex);
                }
 #endif
-
-               /*
-                * This hack is required because a program can open a
-                * pty and redirect a console to it, but if the pty is
-                * closed and the console is not released, then the
-                * slave side will never close.  So release the
-                * redirect when the master closes.
-                */
-               f = tty_release_redirect(tty->link);
-               if (f)
-                       fput(f);
+               tty_vhangup(tty->link);
        }
 }