blocked for more than 120s when we run xfstests #269
Hi all,
This bug will be triggered when dioread_nolock enables. In 3.8 kernel, the test will be blocked for more than 120s, and we get the following messages. *But* in dev branch the system will hang silently without any messages. I need to run test 7 times to hit it.
wenqing: run xfstest 269
kernel: EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts:
acl,user_xattr,dioread_nolock
kernel: INFO: task umount:3376 blocked for more than 120 seconds.
kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
kernel: umount D 0000000000000001 0 3376 3003 0x00000000
kernel: ffff880117417cd8 0000000000000082 ffff880117417bd8 ffff880117416010
kernel: ffff880112d12110 0000000000012080 ffff880117417fd8 0000000000004000
kernel: ffff880117417fd8 0000000000012080 ffff88011331d950 ffff880112d12110
kernel: Call Trace:
kernel: [<ffffffff820ba03c>] ? pagevec_lookup+0x22/0x2b
kernel: [<ffffffff820bb526>] ? truncate_inode_pages_range+0x273/0x3a2
kernel: [<ffffffff8237ef2f>] schedule+0x64/0x66
kernel: [<ffffffffa0203d7c>] ext4_ioend_wait+0x87/0x9f [ext4]
kernel: [<ffffffff8204f0be>] ? wake_up_bit+0x2a/0x2a
kernel: [<ffffffffa0201396>] ext4_evict_inode+0x4a/0x41d [ext4]
kernel: [<ffffffff82102c8c>] evict+0xa2/0x15b
kernel: [<ffffffff821ba2b8>] ? __list_del_entry+0x51/0x98
kernel: [<ffffffff821031b7>] dispose_list+0x3e/0x50
kernel: [<ffffffff8210365b>] evict_inodes+0xdb/0xe7
kernel: [<ffffffff820ef954>] generic_shutdown_super+0x4c/0xd3
kernel: [<ffffffff820efa02>] kill_block_super+0x27/0x69
kernel: [<ffffffff820efe56>] deactivate_locked_super+0x26/0x52
kernel: [<ffffffff820f0ad2>] deactivate_super+0x45/0x4a
kernel: [<ffffffff821074b9>] mntput_no_expire+0x110/0x118
kernel: [<ffffffff82108331>] sys_umount+0x306/0x331
kernel: [<ffffffff82041bf6>] ? sigprocmask+0x63/0x67
kernel: [<ffffffff82386942>] system_call_fastpath+0x16/0x1b
Regards,
- Zheng
Quoted 28 lines · Zheng Liu
Hi all,
This bug will be triggered when
dioread_nolockenables. In 3.8 kernel, the test will be blocked for more than 120s, and we get the following messages. *But* in dev branch the system will hang silently without any messages. I need to run test 7 times to hit it.wenqing: run xfstest 269
kernel: EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts:
acl,user_xattr,dioread_nolock
kernel: INFO: task umount:3376 blocked for more than 120 seconds.
kernel: "echo 0 >/proc/sys/kernel/hung_task_timeout_secs" disables this message.
kernel: umount D 0000000000000001 0 3376 30030x00000000
kernel:ffff880117417cd80000000000000082ffff880117417bd8ffff880117416010
kernel:ffff880112d121100000000000012080ffff880117417fd80000000000004000
kernel:ffff880117417fd80000000000012080ffff88011331d950ffff880112d12110
kernel: Call Trace:
kernel: [<ffffffff820ba03c>] ?pagevec_lookup+0x22/0x2b
kernel: [<ffffffff820bb526>] ?truncate_inode_pages_range+0x273/0x3a2
kernel: [<ffffffff8237ef2f>]schedule+0x64/0x66
kernel: [<ffffffffa0203d7c>]ext4_ioend_wait+0x87/0x9f[ext4]
kernel: [<ffffffff8204f0be>] ?wake_up_bit+0x2a/0x2a
kernel: [<ffffffffa0201396>]ext4_evict_inode+0x4a/0x41d[ext4]
kernel: [<ffffffff82102c8c>]evict+0xa2/0x15b
kernel: [<ffffffff821ba2b8>] ?__list_del_entry+0x51/0x98
kernel: [<ffffffff821031b7>]dispose_list+0x3e/0x50
kernel: [<ffffffff8210365b>]evict_inodes+0xdb/0xe7
Quoted 8 lines
kernel: [<
ffffffff820ef954>]generic_shutdown_super+0x4c/0xd3
kernel: [<ffffffff820efa02>]kill_block_super+0x27/0x69
kernel: [<ffffffff820efe56>]deactivate_locked_super+0x26/0x52
kernel: [<ffffffff820f0ad2>]deactivate_super+0x45/0x4a
kernel: [<ffffffff821074b9>]mntput_no_expire+0x110/0x118
kernel: [<ffffffff82108331>]sys_umount+0x306/0x331
kernel: [<ffffffff82041bf6>] ?sigprocmask+0x63/0x67
kernel: [<ffffffff82386942>]system_call_fastpath+0x16/0x1b
I think I see the problem
Hum, either we missed a wakeup or ioend gets stuck for some reason and is
never processed. Can you maybe post sysrq-w output once the kernel gets stuck? Thanks.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
On Wed, Mar 13, 2013 at 10:15:11AM +0100, Jan Kara wrote:
[snip]
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
I post the sysrq-w output here. But IMHO it is not very useful. So I also post the sysrq-t output.
Heh, curious. Thanks for the data. So worker thinks there's nothing to do
but inode has elevatedi_ioend_count... Maybe we leaked ioend somewhere. I'll check the code when I have time.Ah, I think I see what's going on.
a) Code inext4_ext_direct_IO()is racy wrtiocb->privatehandling (that can get cleared concurrently fromext4_end_io_dio()).
Thanks for tracing this problem. But I am still confused that iocb is allocated on stack in do_sync_write(), and is allocated from slab in ioctx_alloc(). You mean iocb in ext4_ext_direct_IO and ext4_end_io_dio is the same one? Then this iocb could be changed concurrently, and we are blocked for more than 120s. I must miss something.
Quoted 2 lines
b)
ext4_end_io_dio()forgets to free theio_endif size == 0 (but this shouldn't really happen looking intofs/direct_io.c).
Yes, we will return directly from do_blockdev_direct_IO().
Regards,
- Zheng
Quoted 7 lines · Zheng Liu
On Wed, Mar 13, 2013 at 10:15:11AM +0100, Jan Kara wrote:
[snip]Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
I post the sysrq-w output here. But IMHO it is not very useful. So I also post the sysrq-t output.
Heh, curious. Thanks for the data. So worker thinks there's nothing to do
but inode has elevatedi_ioend_count... Maybe we leaked ioend somewhere. I'll check the code when I have time.
Quoted 8 lines
Quoted 3 lines
Ah, I think I see what's going on.
a) Code inext4_ext_direct_IO()is racy wrtiocb->privatehandling (that can get cleared concurrently fromext4_end_io_dio()).Thanks for tracing this problem. But I am still confused that iocb is allocated on stack in
do_sync_write(), and is allocated from slab inioctx_alloc(). You mean iocb inext4_ext_direct_IOandext4_end_io_diois the same one?
Yes, it is.
Quoted 2 lines
Then this iocb could be changed concurrently, and we are blocked for more than 120s. I must miss something.
Well, the hang results from direct IO code forgetting to callext4_free_io_end() in some (likely error recovery) path. So inode->i_ioend_count remains elevated and we never finish waiting in ext4_evict_inode(). How that forgotten ext4_free_io_end() really happens isn't 100% clear to me but I really suspect something with concurrent iocb modification goes wrong...
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR