writing/reading from network while serving a block device request
I modified a block device driver for a ramdisk (similar to the one here:
http://www.linuxforu.com/2012/02/device-drivers-disk-on-ram-block-drivers/)
so that driver reads/writes from the network. I basically removed memcpy
and replaced it with an in-kernel network socket read/write.
And here is what I get: a warning that irqs are disabled. The warning is
thrown from the line WARN_ON_ONCE(in_irq() || irqs_disabled()); inside the
function _local_bh_enable_ip.
My understanding is that what I did should work since all disk requests
are queued in the work queue supplied in the gendisk. And job handler
(supplied when blk_init_queue() is called) will be called from the typical
kernel context, where irqs should be enabled. But I guess I was wrong.
Anyone can help with a work-around?
Here is the top part of the stack trace spelled out by the kernel:
[ 697.480153] [<ffffffff8105931f>] warn_slowpath_common+0x7f/0xc0
[ 697.480159] [<ffffffff8105937a>] warn_slowpath_null+0x1a/0x20
[ 697.480166] [<ffffffff8106172a>] local_bh_enable+0x7a/0xa0
[ 697.480175] [<ffffffff815974b3>] lock_sock_nested+0x53/0x60
[ 697.480183] [<ffffffff815eedfc>] tcp_sendmsg+0x2c/0xe60
[ 697.480197] [<ffffffff8134226c>] ? vsnprintf+0x35c/0x640
[ 697.480207] [<ffffffff81618331>] inet_sendmsg+0x61/0xb0
[ 697.480216] [<ffffffff81592912>] sock_sendmsg+0xd2/0xf0
[ 697.480226] [<ffffffff8133708e>] k_send+0x6e/0x80
[ 697.480236] [<ffffffffa02b34ee>] ramdevice_read+0x5e/0xd0 [dor]
[ 697.480244] [<ffffffffa02b31a3>] rb_request+0x133/0x1b0 [dor]
No comments:
Post a Comment