1. 18 Mar, 2013 34 commits
  2. 15 Mar, 2013 6 commits
    • zhangwei(Jovi)'s avatar
      sysrq: fix inconstistent help message of sysrq key · afa80ccb
      zhangwei(Jovi) authored
      Currently help message of /proc/sysrq-trigger highlight its
      upper-case characters, like below:
      
            SysRq : HELP : loglevel(0-9) reBoot Crash terminate-all-tasks(E)
            memory-full-oom-kill(F) kill-all-tasks(I) ...
      
      this would confuse user trigger sysrq by upper-case character, which is
      inconsistent with the real lower-case character registed key.
      
      This inconsistent help message will also lead more confused when
      26 upper-case letters put into use in future.
      
      This patch fix it.
      
      Thanks the comments from Andrew and Randy.
      Signed-off-by: default avatarzhangwei(Jovi) <jovi.zhangwei@huawei.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      afa80ccb
    • Peter Hurley's avatar
      tty: Signal SIGHUP before hanging up ldisc · 25fdf243
      Peter Hurley authored
      An exiting session leader can hang if a foreground process is
      blocking for line discipline i/o, eg. in n_tty_read(). This happens
      because the blocking reader is holding an ldisc reference (indicating
      the line discipline is in-use) which prevents __tty_hangup() from
      recycling the line discipline. Although waiters are woken before
      attempting to gain exclusive access for changing the ldisc, the
      blocking reader in this case will not exit the i/o loop since it
      has not yet received SIGHUP (because it has not been sent).
      
      Instead, perform signalling first, then recycle the line discipline.
      
      Fixes:
      
      INFO: task init:1 blocked for more than 120 seconds.
      "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      init            D 00000000001d7180  2688     1      0 0x00000002
       ffff8800b9acfba8 0000000000000002 00000000001d7180 ffff8800b9b10048
       ffff8800b94cb000 ffff8800b9b10000 00000000001d7180 00000000001d7180
       ffff8800b9b10000 ffff8800b9acffd8 00000000001d7180 00000000001d7180
      Call Trace:
       [<ffffffff83db9909>] __schedule+0x2e9/0x3b0
       [<ffffffff83db9b35>] schedule+0x55/0x60
       [<ffffffff83db74ba>] schedule_timeout+0x3a/0x370
       [<ffffffff81182349>] ? mark_held_locks+0xf9/0x130
       [<ffffffff83dbab38>] ? down_failed+0x108/0x200
       [<ffffffff83dbb7ab>] ? _raw_spin_unlock_irq+0x2b/0x80
       [<ffffffff81182608>] ? trace_hardirqs_on_caller+0x128/0x160
       [<ffffffff83dbab61>] down_failed+0x131/0x200
       [<ffffffff83dbbfad>] ? tty_ldisc_lock_pair_timeout+0xcd/0x120
       [<ffffffff83dbae03>] ldsem_down_write+0xd3/0x113
       [<ffffffff83dbbfad>] ? tty_ldisc_lock_pair_timeout+0xcd/0x120
       [<ffffffff8118264d>] ? trace_hardirqs_on+0xd/0x10
       [<ffffffff83dbbfad>] tty_ldisc_lock_pair_timeout+0xcd/0x120
       [<ffffffff81c3df60>] tty_ldisc_hangup+0xd0/0x220
       [<ffffffff81c35bd7>] __tty_hangup+0x137/0x4f0
       [<ffffffff81c37c7c>] disassociate_ctty+0x6c/0x230
       [<ffffffff8111290c>] do_exit+0x41c/0x590
       [<ffffffff8107ad34>] ? syscall_trace_enter+0x24/0x2e0
       [<ffffffff81112b4a>] do_group_exit+0x8a/0xc0
       [<ffffffff81112b92>] sys_exit_group+0x12/0x20
       [<ffffffff83dc49d8>] tracesys+0xe1/0xe6
      1 lock held by init/1:
       #0: (&tty->ldisc_sem){++++++}, at: [<ffffffff83dbbfad>] tty_ldisc_lock_pair_timeout+0xcd/0x120
      Reported-by: default avatarSasha Levin <levinsasha928@gmail.com>
      Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
      Acked-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      25fdf243
    • Peter Hurley's avatar
      tty: Signal foreground group processes in hangup · f91e2590
      Peter Hurley authored
      When the session leader is exiting, signal the foreground group
      processes as part of the hangup sequence, instead of after the
      hangup is complete. This prepares for hanging up the
      line discipline _after_ signalling processes which
      may be blocking on ldisc i/o.
      
      Parameterize __tty_hangup() to distinguish between when the
      session leader is exiting and all other hangups; signal the
      foreground group after signalling the session leader and its
      process group, which preserves the original signal order.
      Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
      Acked-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f91e2590
    • Peter Hurley's avatar
      tty: Use spin_lock() inside existing critical region · bc30c3b2
      Peter Hurley authored
      The interrupt state does not need to be saved, disabled and
      restored here; interrupts are already off because this lock
      is bracketed by spin_lock_irq/spin_unlock_irq.
      Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
      Acked-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bc30c3b2
    • Peter Hurley's avatar
      tty: Fix spinlock flavor in non-atomic __tty_hangup() · 20cc225b
      Peter Hurley authored
      __tty_hangup() and tty_vhangup() cannot be called from atomic context,
      so locks do not need to preserve the interrupt state (although,
      still disable interrupts).
      Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
      Acked-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      20cc225b
    • Peter Hurley's avatar
      tty: Refactor session leader SIGHUP from __tty_hangup() · ea648a47
      Peter Hurley authored
      Reduce complexity of __tty_hangup(); separate SIGHUP signalling
      into tty_signal_session_leader().
      Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
      Acked-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ea648a47