tty: vt: Fix !TASK_RUNNING diagnostic warning from paste_selection()
Pasting text with gpm on a VC produced warning [1]. Reset task state
to TASK_RUNNING in the paste_selection() loop, if the loop did not
sleep.
[1]
WARNING: CPU: 6 PID: 1960 at /home/peter/src/kernels/mainline/kernel/sched/core.c:7286 __might_sleep+0x7f/0x90()
do not call blocking ops when !TASK_RUNNING; state=1 set at [<
ffffffff8151805e>] paste_selection+0x9e/0x1a0
Modules linked in: btrfs xor raid6_pq ufs qnx4 hfsplus hfs minix ntfs msdos jfs xfs libcrc32c .....
CPU: 6 PID: 1960 Comm: gpm Not tainted 4.1.0-rc7+tty-xeon+debug #rc7+tty
Hardware name: Dell Inc. Precision WorkStation T5400 /0RW203, BIOS A11 04/30/2012
ffffffff81c9c0a0 ffff8802b0fd3ac8 ffffffff8185778a 0000000000000001
ffff8802b0fd3b18 ffff8802b0fd3b08 ffffffff8108039a ffffffff82ae8510
ffffffff81c9ce00 0000000000000015 0000000000000000 0000000000000000
Call Trace:
[<
ffffffff8185778a>] dump_stack+0x4f/0x7b
[<
ffffffff8108039a>] warn_slowpath_common+0x8a/0xc0
[<
ffffffff81080416>] warn_slowpath_fmt+0x46/0x50
[<
ffffffff810ddced>] ? __lock_acquire+0xe2d/0x13a0
[<
ffffffff8151805e>] ? paste_selection+0x9e/0x1a0
[<
ffffffff8151805e>] ? paste_selection+0x9e/0x1a0
[<
ffffffff810ad4ff>] __might_sleep+0x7f/0x90
[<
ffffffff8185f76a>] down_read+0x2a/0xa0
[<
ffffffff810bb1d8>] ? sched_clock_cpu+0xb8/0xe0
[<
ffffffff8150d1dc>] n_tty_receive_buf_common+0x4c/0xba0
[<
ffffffff810dc875>] ? mark_held_locks+0x75/0xa0
[<
ffffffff81861c95>] ? _raw_spin_unlock_irqrestore+0x65/0x80
[<
ffffffff810b49a1>] ? get_parent_ip+0x11/0x50
[<
ffffffff8150dd44>] n_tty_receive_buf2+0x14/0x20
[<
ffffffff81518117>] paste_selection+0x157/0x1a0
[<
ffffffff810b77b0>] ? wake_up_state+0x20/0x20
[<
ffffffff815203f8>] tioclinux+0xb8/0x2c0
[<
ffffffff81515bfe>] vt_ioctl+0xaee/0x11a0
[<
ffffffff810baf75>] ? sched_clock_local+0x25/0x90
[<
ffffffff810bbe11>] ? vtime_account_user+0x91/0xa0
[<
ffffffff8150810c>] tty_ioctl+0x20c/0xe20
[<
ffffffff810bbe11>] ? vtime_account_user+0x91/0xa0
[<
ffffffff810b49a1>] ? get_parent_ip+0x11/0x50
[<
ffffffff810b4a69>] ? preempt_count_sub+0x49/0x50
[<
ffffffff811ab71c>] ? context_tracking_exit+0x5c/0x290
[<
ffffffff811ab71c>] ? context_tracking_exit+0x5c/0x290
[<
ffffffff81248b98>] do_vfs_ioctl+0x318/0x570
[<
ffffffff810dca8d>] ? trace_hardirqs_on+0xd/0x10
[<
ffffffff810dc9b5>] ? trace_hardirqs_on_caller+0x115/0x1e0
[<
ffffffff81254acc>] ? __fget_light+0x6c/0xa0
[<
ffffffff81248e71>] SyS_ioctl+0x81/0xa0
[<
ffffffff81862832>] system_call_fastpath+0x16/0x7a
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>