inet: Clean up inet_csk_wait_for_connect() vs. might_sleep()
I got the following trace with current net-next kernel :
[14723.885290] WARNING: CPU: 26 PID: 22658 at kernel/sched/core.c:7285 __might_sleep+0x89/0xa0()
[14723.885325] do not call blocking ops when !TASK_RUNNING; state=1 set at [<
ffffffff810e8734>] prepare_to_wait_exclusive+0x34/0xa0
[14723.885355] CPU: 26 PID: 22658 Comm: netserver Not tainted 4.0.0-dbg-DEV #1379
[14723.885359]
ffffffff81a223a8 ffff881fae9e7ca8 ffffffff81650b5d 0000000000000001
[14723.885364]
ffff881fae9e7cf8 ffff881fae9e7ce8 ffffffff810a72e7 0000000000000000
[14723.885367]
ffffffff81a57620 000000000000093a 0000000000000000 ffff881fae9e7e64
[14723.885371] Call Trace:
[14723.885377] [<
ffffffff81650b5d>] dump_stack+0x4c/0x65
[14723.885382] [<
ffffffff810a72e7>] warn_slowpath_common+0x97/0xe0
[14723.885386] [<
ffffffff810a73e6>] warn_slowpath_fmt+0x46/0x50
[14723.885390] [<
ffffffff810f4c5d>] ? trace_hardirqs_on_caller+0x10d/0x1d0
[14723.885393] [<
ffffffff810e8734>] ? prepare_to_wait_exclusive+0x34/0xa0
[14723.885396] [<
ffffffff810e8734>] ? prepare_to_wait_exclusive+0x34/0xa0
[14723.885399] [<
ffffffff810ccdc9>] __might_sleep+0x89/0xa0
[14723.885403] [<
ffffffff81581846>] lock_sock_nested+0x36/0xb0
[14723.885406] [<
ffffffff815829a3>] ? release_sock+0x173/0x1c0
[14723.885411] [<
ffffffff815ea1f7>] inet_csk_accept+0x157/0x2a0
[14723.885415] [<
ffffffff810e8900>] ? abort_exclusive_wait+0xc0/0xc0
[14723.885419] [<
ffffffff8161b96d>] inet_accept+0x2d/0x150
[14723.885424] [<
ffffffff8157db6f>] SYSC_accept4+0xff/0x210
[14723.885428] [<
ffffffff8165a451>] ? retint_swapgs+0xe/0x44
[14723.885431] [<
ffffffff810f4c5d>] ? trace_hardirqs_on_caller+0x10d/0x1d0
[14723.885437] [<
ffffffff81369c0e>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[14723.885441] [<
ffffffff8157ef40>] SyS_accept+0x10/0x20
[14723.885444] [<
ffffffff81659872>] system_call_fastpath+0x12/0x17
[14723.885447] ---[ end trace
ff74cd83355b1873 ]---
In commit
26cabd31259ba43f68026ce3f62b78094124333f
Peter added a sched_annotate_sleep() in sk_wait_event()
Is the following patch needed as well ?
Alternative would be to use sk_wait_event() from inet_csk_wait_for_connect()
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: David S. Miller <davem@davemloft.net>