Skip to content
This repository has been archived by the owner on Jan 18, 2020. It is now read-only.

Suspend with btrfs rootfs will occasionally hang #1

Open
zhongfu opened this issue Apr 4, 2017 · 2 comments
Open

Suspend with btrfs rootfs will occasionally hang #1

zhongfu opened this issue Apr 4, 2017 · 2 comments

Comments

@zhongfu
Copy link
Owner

zhongfu commented Apr 4, 2017

When the kernel syncs filesystems after it's told to go to sleep with echo mem > /sys/power/state, it might hang due to btrfs-transaction attempting to perform I/O on the (now suspended) root cryptdevice.

dmesg:

[ 5073.146612] INFO: task btrfs-transacti:388 blocked for more than 120 seconds.
[ 5073.146621]       Tainted: G     U  W       4.10.0-15-generic #17-Ubuntu
[ 5073.146623] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 5073.146626] btrfs-transacti D    0   388      2 0x00000000
[ 5073.146630] Call Trace:
[ 5073.146639]  __schedule+0x233/0x6f0
[ 5073.146642]  schedule+0x36/0x80
[ 5073.146645]  schedule_timeout+0x22a/0x3f0
[ 5073.146691]  ? extent_write_cache_pages.isra.44.constprop.61+0x25f/0x410 [btrfs]
[ 5073.146696]  ? ktime_get+0x41/0xb0
[ 5073.146698]  io_schedule_timeout+0xa4/0x110
[ 5073.146703]  wait_on_page_bit_common+0x118/0x1d0
[ 5073.146706]  ? unlock_page+0x30/0x30
[ 5073.146709]  __filemap_fdatawait_range+0x114/0x190
[ 5073.146713]  filemap_fdatawait_range+0x14/0x30
[ 5073.146746]  btrfs_wait_ordered_range+0x6d/0x100 [btrfs]
[ 5073.146778]  __btrfs_wait_cache_io+0x49/0x1e0 [btrfs]
[ 5073.146808]  btrfs_wait_cache_io+0x2c/0x30 [btrfs]
[ 5073.146835]  btrfs_start_dirty_block_groups+0x197/0x440 [btrfs]
[ 5073.146863]  btrfs_commit_transaction+0x13b/0x910 [btrfs]
[ 5073.146890]  ? start_transaction+0x99/0x460 [btrfs]
[ 5073.146917]  transaction_kthread+0x1a6/0x1c0 [btrfs]
[ 5073.146921]  kthread+0x101/0x140
[ 5073.146946]  ? btrfs_cleanup_transaction+0x530/0x530 [btrfs]
[ 5073.146950]  ? kthread_create_on_node+0x60/0x60
[ 5073.146954]  ret_from_fork+0x2c/0x40
@zhongfu
Copy link
Owner Author

zhongfu commented Apr 4, 2017

Perhaps we could fork echo mem > /sys/power/state, and run cryptsetup luksResume if that doesn't end within 5 (or so) seconds?

However, even if we unlock the LUKS device, we (probably) can't cancel sleep, so perhaps we can figure out how to wake up again automatically (then sync, do luksSuspend, and try to go to sleep again)

@zhongfu
Copy link
Owner Author

zhongfu commented Apr 4, 2017

We could also stop the kernel from doing sys_sync() on suspend by setting CONFIG_SUSPEND_SKIP_SYNC=y, but that requires a kernel recompile, which might be a little overkill.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant