Warning when unloading network block device

From: Mikulas Patocka
Date: Fri Apr 15 2016 - 13:08:32 EST


Hi

The patch 23272a6754b81ff6503e09c743bb4ceeeab39997 (nbd: Remove signal
usage) triggers a warning in nbd when the network block device is unloaded
- WARN_ON_ONCE(in_irq() || irqs_disabled()) in the function
__local_bh_enable_ip. The reason for the warning is that the function
kernel_sock_shutdown is called with interrupts disabled.

block nbd0: NBD_DISCONNECT
block nbd0: shutting down socket
------------[ cut here ]------------
WARNING: CPU: 10 PID: 11939 at kernel/softirq.c:150 __local_bh_enable_ip+0x66/0x90
Call Trace:
[<ffffffff8122dde3>] ? dump_stack+0x46/0x63
[<ffffffff81050f57>] ? __warn+0xe7/0x100
[<ffffffff810555f6>] ? __local_bh_enable_ip+0x66/0x90
[<ffffffff813e2ddf>] ? inet_shutdown+0x3f/0x120
[<ffffffffa00693b0>] ? sock_shutdown+0x40/0x80 [nbd]
[<ffffffffa006a228>] ? __nbd_ioctl+0x5b8/0xa40 [nbd]
[<ffffffffa19cc169>] ? soft_cursor+0x169/0x1e6 [softcursor]
[<ffffffffa19e37ed>] ? bit_cursor+0x59d/0x5d0 [bitblit]
[<ffffffffa19e8801>] ? cursor_timer_handler+0x11/0x40 [fbcon]
[<ffffffff8108dd6d>] ? up+0xd/0x50
[<ffffffff81092ba6>] ? console_unlock+0x216/0x580
[<ffffffff8108c168>] ? remove_wait_queue+0x18/0x60
[<ffffffff812a6dca>] ? n_tty_write+0x24a/0x460
[<ffffffff811f7cec>] ? security_capable+0x3c/0x50
[<ffffffffa006a717>] ? nbd_ioctl+0x67/0x99 [nbd]
[<ffffffff8121d2d9>] ? blkdev_ioctl+0x649/0xa70
[<ffffffff81160c2e>] ? __vfs_write+0x1e/0xe0
[<ffffffff811789c2>] ? dput+0x42/0x2b0
[<ffffffff81199e14>] ? block_ioctl+0x34/0x40
[<ffffffff81174806>] ? do_vfs_ioctl+0x96/0x5b0
[<ffffffff81161c31>] ? vfs_write+0x131/0x190
[<ffffffff81174db1>] ? SyS_ioctl+0x91/0xa0
[<ffffffff81402e1f>] ? entry_SYSCALL_64_fastpath+0x17/0x93
---[ end trace 1956420c2e5f102b ]---
block nbd0: Receive control failed (result -32)

Mikulas