Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 207918
b: refs/heads/master
c: 11dbf20
h: refs/heads/master
v: v3
  • Loading branch information
Arnd Bergmann authored and Greg Kroah-Hartman committed Aug 10, 2010
1 parent d9a42d8 commit dcb650e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a0821df6e57c8af0053963d0d08c8d5198ea077d
refs/heads/master: 11dbf203922dc70a340417c895c95fb96f6b7068
4 changes: 3 additions & 1 deletion trunk/drivers/char/pty.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
if (tty->driver == ptm_driver)
devpts_pty_kill(tty->link);
#endif
tty_vhangup_locked(tty->link);
tty_unlock();
tty_vhangup(tty->link);
tty_lock();
}
}

Expand Down
24 changes: 12 additions & 12 deletions trunk/drivers/char/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ void tty_wakeup(struct tty_struct *tty)
EXPORT_SYMBOL_GPL(tty_wakeup);

/**
* do_tty_hangup - actual handler for hangup events
* __tty_hangup - actual handler for hangup events
* @work: tty device
*
* This can be called by the "eventd" kernel thread. That is process
Expand All @@ -492,7 +492,7 @@ EXPORT_SYMBOL_GPL(tty_wakeup);
* tasklist_lock to walk task list for hangup event
* ->siglock to protect ->signal/->sighand
*/
void tty_vhangup_locked(struct tty_struct *tty)
void __tty_hangup(struct tty_struct *tty)
{
struct file *cons_filp = NULL;
struct file *filp, *f = NULL;
Expand All @@ -512,10 +512,12 @@ void tty_vhangup_locked(struct tty_struct *tty)
}
spin_unlock(&redirect_lock);

tty_lock();

/* inuse_filps is protected by the single tty lock,
this really needs to change if we want to flush the
workqueue with the lock held */
check_tty_count(tty, "do_tty_hangup");
check_tty_count(tty, "tty_hangup");

file_list_lock();
/* This breaks for file handles being sent over AF_UNIX sockets ? */
Expand Down Expand Up @@ -594,6 +596,9 @@ void tty_vhangup_locked(struct tty_struct *tty)
*/
set_bit(TTY_HUPPED, &tty->flags);
tty_ldisc_enable(tty);

tty_unlock();

if (f)
fput(f);
}
Expand All @@ -603,9 +608,7 @@ static void do_tty_hangup(struct work_struct *work)
struct tty_struct *tty =
container_of(work, struct tty_struct, hangup_work);

tty_lock();
tty_vhangup_locked(tty);
tty_unlock();
__tty_hangup(tty);
}

/**
Expand Down Expand Up @@ -643,13 +646,12 @@ void tty_vhangup(struct tty_struct *tty)

printk(KERN_DEBUG "%s vhangup...\n", tty_name(tty, buf));
#endif
tty_lock();
tty_vhangup_locked(tty);
tty_unlock();
__tty_hangup(tty);
}

EXPORT_SYMBOL(tty_vhangup);


/**
* tty_vhangup_self - process vhangup for own ctty
*
Expand Down Expand Up @@ -727,10 +729,8 @@ void disassociate_ctty(int on_exit)
if (tty) {
tty_pgrp = get_pid(tty->pgrp);
if (on_exit) {
tty_lock();
if (tty->driver->type != TTY_DRIVER_TYPE_PTY)
tty_vhangup_locked(tty);
tty_unlock();
tty_vhangup(tty);
}
tty_kref_put(tty);
} else if (on_exit) {
Expand Down

0 comments on commit dcb650e

Please sign in to comment.