btrfs blocks suspend while scrub is running
Hello Everyone,
I just noticed that btrfs blocks the kernel from suspending while scrub is running:
Happy new year btw :)
Linux gecko 6.1.1-1-default #1 SMP PREEMPT_DYNAMIC Thu Dec 22 15:37:40 UTC 2022 (e71748d) x86_64 x86_64 x86_64 GNU/Linux
dmesg:
[139539.490791] BTRFS info (device dm-0): scrub: started on devid 1 [139825.355413] PM: suspend entry (deep) [139825.457561] Filesystems sync: 0.102 seconds [139825.459266] Freezing user space processes ... [139845.467124] Freezing of tasks failed after 20.007 seconds (1 tasks refusing to freeze, wq_busy=0): [139845.467315] task:btrfs state:D stack:0 pid:29703 ppid:29700 flags:0x00004006 [139845.467321] Call Trace: [139845.467323] <TASK> [139845.467327] __schedule+0x360/0x1350 [139845.467340] schedule+0x5a/0xd0 [139845.467344] io_schedule+0x42/0x70 [139845.467348] blk_mq_get_tag+0x11a/0x2a0 [139845.467353] ? destroy_sched_domains_rcu+0x30/0x30 [139845.467358] __blk_mq_alloc_requests+0x189/0x2e0 [139845.467362] blk_mq_submit_bio+0x2d6/0x5e0 [139845.467366] __submit_bio+0xf5/0x180 [139845.467370] submit_bio_noacct_nocheck+0xe5/0x2d0 [139845.467376] scrub_add_sector_to_rd_bio+0x2a8/0x320 [btrfs c8c8418dedbc5b328d9ff38d6a65c4e4e45be0e5] [139845.467485] scrub_sectors+0x1a8/0x4d0 [btrfs c8c8418dedbc5b328d9ff38d6a65c4e4e45be0e5] [139845.467585] scrub_simple_mirror+0x393/0x800 [btrfs c8c8418dedbc5b328d9ff38d6a65c4e4e45be0e5] [139845.467689] ? blk_mq_sched_dispatch_requests+0x30/0x60 [139845.467695] ? __wake_up_common_lock+0x87/0xc0 [139845.467702] scrub_stripe+0x36d/0x6d0 [btrfs c8c8418dedbc5b328d9ff38d6a65c4e4e45be0e5] [139845.467803] ? start_transaction+0x218/0x5b0 [btrfs c8c8418dedbc5b328d9ff38d6a65c4e4e45be0e5] [139845.467888] ? kmem_cache_alloc+0x16a/0x360 [139845.467895] scrub_chunk+0xcb/0x130 [btrfs c8c8418dedbc5b328d9ff38d6a65c4e4e45be0e5] [139845.468000] scrub_enumerate_chunks+0x2d4/0x750 [btrfs c8c8418dedbc5b328d9ff38d6a65c4e4e45be0e5] [139845.468164] ? destroy_sched_domains_rcu+0x30/0x30 [139845.468170] btrfs_scrub_dev+0x241/0x660 [btrfs c8c8418dedbc5b328d9ff38d6a65c4e4e45be0e5] [139845.468323] ? __check_object_size+0x1e6/0x200 [139845.468330] btrfs_ioctl+0x6fa/0x25c0 [btrfs c8c8418dedbc5b328d9ff38d6a65c4e4e45be0e5] [139845.468475] ? page_add_new_anon_rmap+0x6c/0x120 [139845.468481] ? cap_safe_nice+0x3f/0x80 [139845.468487] ? security_task_setioprio+0x2f/0x50 [139845.468495] ? set_task_ioprio+0xa3/0x130 [139845.468503] __x64_sys_ioctl+0x8d/0xd0 [139845.468511] do_syscall_64+0x58/0x80 [139845.468518] ? syscall_exit_to_user_mode+0x17/0x40 [139845.468524] ? do_syscall_64+0x67/0x80 [139845.468528] ? do_syscall_64+0x67/0x80 [139845.468533] ? sigprocmask+0xa5/0xd0 [139845.468539] ? __x64_sys_rt_sigprocmask+0x76/0xd0 [139845.468544] ? syscall_exit_to_user_mode+0x17/0x40 [139845.468550] ? do_syscall_64+0x67/0x80 [139845.468554] ? exc_page_fault+0x66/0x150 [139845.468560] entry_SYSCALL_64_after_hwframe+0x63/0xcd [139845.468567] RIP: 0033:0x7f05370ac9bf [139845.468572] RSP: 002b:00007f0536f9ec80 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 [139845.468577] RAX: ffffffffffffffda RBX: 000055e227629420 RCX: 00007f05370ac9bf [139845.468581] RDX: 000055e227629420 RSI: 00000000c400941b RDI: 0000000000000004 [139845.468584] RBP: 0000000000000000 R08: 00007ffdc579f777 R09: 0000000000000000 [139845.468586] R10: 0000000000000000 R11: 0000000000000246 R12: fffffffffffffdb8 [139845.468589] R13: 000000000000006b R14: 00007ffdc579f680 R15: 00007f053679f000 [139845.468595] </TASK>
[139845.468734] OOM killer enabled. [139845.468736] Restarting tasks ... done. [139845.486950] random: crng reseeded on system resumption [139845.603958] PM: suspend exit [139845.604042] PM: suspend entry (s2idle) [139845.694115] Filesystems sync: 0.090 seconds [139845.694367] Freezing user space processes ... [139865.695291] Freezing of tasks failed after 20.000 seconds (1 tasks refusing to freeze, wq_busy=0): [139865.695456] task:btrfs state:D stack:0 pid:29703 ppid:29700 flags:0x00004006 [139865.695460] Call Trace: [139865.695461] <TASK> [139865.695464] __schedule+0x360/0x1350 [139865.695475] schedule+0x5a/0xd0 [139865.695478] io_schedule+0x42/0x70 [139865.695480] blk_mq_get_tag+0x11a/0x2a0 [139865.695485] ? destroy_sched_domains_rcu+0x30/0x30 [139865.695488] __blk_mq_alloc_requests+0x189/0x2e0 [139865.695491] blk_mq_submit_bio+0x2d6/0x5e0 [139865.695494] __submit_bio+0xf5/0x180 [139865.695497] submit_bio_noacct_nocheck+0xe5/0x2d0 [139865.695501] scrub_add_sector_to_rd_bio+0x106/0x320 [btrfs c8c8418dedbc5b328d9ff38d6a65c4e4e45be0e5] [139865.695588] scrub_sectors+0x1a8/0x4d0 [btrfs c8c8418dedbc5b328d9ff38d6a65c4e4e45be0e5] [139865.695653] scrub_simple_mirror+0x393/0x800 [btrfs c8c8418dedbc5b328d9ff38d6a65c4e4e45be0e5] [139865.695748] ? __wake_up_common_lock+0x87/0xc0 [139865.695754] scrub_stripe+0x36d/0x6d0 [btrfs c8c8418dedbc5b328d9ff38d6a65c4e4e45be0e5] [139865.695853] ? start_transaction+0x218/0x5b0 [btrfs c8c8418dedbc5b328d9ff38d6a65c4e4e45be0e5] [139865.695935] ? kmem_cache_alloc+0x16a/0x360 [139865.695942] scrub_chunk+0xcb/0x130 [btrfs c8c8418dedbc5b328d9ff38d6a65c4e4e45be0e5] [139865.696038] scrub_enumerate_chunks+0x2d4/0x750 [btrfs c8c8418dedbc5b328d9ff38d6a65c4e4e45be0e5] [139865.696125] ? destroy_sched_domains_rcu+0x30/0x30 [139865.696128] btrfs_scrub_dev+0x241/0x660 [btrfs c8c8418dedbc5b328d9ff38d6a65c4e4e45be0e5] [139865.696198] ? __check_object_size+0x1e6/0x200 [139865.696201] btrfs_ioctl+0x6fa/0x25c0 [btrfs c8c8418dedbc5b328d9ff38d6a65c4e4e45be0e5] [139865.696255] ? page_add_new_anon_rmap+0x6c/0x120 [139865.696258] ? cap_safe_nice+0x3f/0x80 [139865.696260] ? security_task_setioprio+0x2f/0x50 [139865.696264] ? set_task_ioprio+0xa3/0x130 [139865.696267] __x64_sys_ioctl+0x8d/0xd0 [139865.696271] do_syscall_64+0x58/0x80 [139865.696275] ? syscall_exit_to_user_mode+0x17/0x40 [139865.696277] ? do_syscall_64+0x67/0x80 [139865.696279] ? do_syscall_64+0x67/0x80 [139865.696290] ? sigprocmask+0xa5/0xd0 [139865.696293] ? __x64_sys_rt_sigprocmask+0x76/0xd0 [139865.696294] ? syscall_exit_to_user_mode+0x17/0x40 [139865.696296] ? do_syscall_64+0x67/0x80 [139865.696298] ? exc_page_fault+0x66/0x150 [139865.696300] entry_SYSCALL_64_after_hwframe+0x63/0xcd [139865.696303] RIP: 0033:0x7f05370ac9bf [139865.696305] RSP: 002b:00007f0536f9ec80 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 [139865.696307] RAX: ffffffffffffffda RBX: 000055e227629420 RCX: 00007f05370ac9bf [139865.696308] RDX: 000055e227629420 RSI: 00000000c400941b RDI: 0000000000000004 [139865.696309] RBP: 0000000000000000 R08: 00007ffdc579f777 R09: 0000000000000000 [139865.696310] R10: 0000000000000000 R11: 0000000000000246 R12: fffffffffffffdb8 [139865.696311] R13: 000000000000006b R14: 00007ffdc579f680 R15: 00007f053679f000 [139865.696313] </TASK>
[139865.696404] OOM killer enabled. [139865.696405] Restarting tasks ... done. [139865.701169] random: crng reseeded on system resumption [139865.815937] PM: suspend exit [139962.422007] BTRFS info (device dm-0): scrub: finished on devid 1 with status: 0 [139962.460093] BTRFS info (device dm-0): balance: start -dusage=0 [139962.460673] BTRFS info (device dm-0): balance: ended with status: 0 [139962.520561] BTRFS info (device dm-0): balance: start -dusage=5 [139962.520838] BTRFS info (device dm-0): balance: ended with status: 0 [139962.569264] BTRFS info (device dm-0): balance: start -dusage=10 [139962.569535] BTRFS info (device dm-0): balance: ended with status: 0 [139962.618005] BTRFS info (device dm-0): balance: start -musage=0 -susage=0 [139962.618244] BTRFS info (device dm-0): balance: ended with status: 0 [139962.664231] BTRFS info (device dm-0): balance: start -musage=5 -susage=5 [139962.664424] BTRFS info (device dm-0): relocating block group 373720088576 flags system|dup [139962.753203] BTRFS info (device dm-0): 1 enospc errors during balance [139962.753212] BTRFS info (device dm-0): balance: ended with status: -28 [139999.218253] systemd-journald[619]: Data hash table of /var/log/journal/7f882ab05c7f4c0d9bdef2f824867aff/system.journal has a fill level at 75.1 (2732 of 3640 items, 2097152 file size, 767 bytes per hash table item), suggesting rotation. [139999.218264] systemd-journald[619]: /var/log/journal/7f882ab05c7f4c0d9bdef2f824867aff/system.journal: Journal header limits reached or header out-of-date, rotating. [140004.594339] PM: suspend entry (deep) [140004.679368] Filesystems sync: 0.085 seconds [140004.680866] Freezing user space processes ... (elapsed 0.002 seconds) done. [140004.683244] OOM killer disabled. [140004.683245] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [140004.684786] printk: Suspending console(s) (use no_console_suspend to debug) [140004.740165] sd 4:0:0:0: [sda] Synchronizing SCSI cache [140004.741331] sd 4:0:0:0: [sda] Stopping disk [140004.840596] sd 6:0:0:0: [sdb] Synchronizing SCSI cache [140005.132914] ACPI: EC: interrupt blocked [140005.146380] ACPI: PM: Preparing to enter system sleep state S3 [140005.147123] ACPI: EC: event blocked [140005.147124] ACPI: EC: EC stopped [140005.147125] ACPI: PM: Saving platform NVS memory [140005.147158] Disabling non-boot CPUs ... [140005.148795] smpboot: CPU 1 is now offline [140005.150968] smpboot: CPU 2 is now offline [140005.152542] smpboot: CPU 3 is now offline [140005.188662] ACPI: PM: Low-level resume complete [140005.188691] ACPI: EC: EC started [140005.188691] ACPI: PM: Restoring platform NVS memory [140005.189028] Enabling non-boot CPUs ... [140005.189123] x86: Booting SMP configuration: [140005.189124] smpboot: Booting Node 0 Processor 1 APIC 0x1 [140005.190704] CPU1 is up [140005.190762] smpboot: Booting Node 0 Processor 2 APIC 0x2 [140005.226147] CPU2 is up [140005.226225] smpboot: Booting Node 0 Processor 3 APIC 0x3 [140005.227136] CPU3 is up [140005.228950] ACPI: PM: Waking up from system sleep state S3 [140005.289422] ACPI: EC: interrupt unblocked [140005.292284] ACPI: EC: event unblocked [140005.292625] sd 4:0:0:0: [sda] Starting disk [140005.608953] usb 2-5: reset full-speed USB device number 3 using xhci_hcd [140005.619847] ata5: SATA link up 6.0 Gbps (SStatus 133 SControl 300) [140005.619866] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300) [140005.620318] ata5.00: ACPI cmd f5/00:00:00:00:00:a0(SECURITY FREEZE LOCK) filtered out [140005.620568] ata5.00: supports DRM functions and may not be fully accessible [140005.624829] ata5.00: ACPI cmd f5/00:00:00:00:00:a0(SECURITY FREEZE LOCK) filtered out [140005.625230] ata5.00: supports DRM functions and may not be fully accessible [140005.628634] ata5.00: configured for UDMA/133 [140005.639260] ata5.00: Enabling discard_zeroes_data [140005.714278] ata1.00: ACPI cmd ef/10:03:00:00:00:a0(SET FEATURES) filtered out [140005.719683] ata1.00: ACPI cmd ef/10:03:00:00:00:a0(SET FEATURES) filtered out [140005.721876] ata1.00: configured for UDMA/100 [140005.885012] usb 2-11: reset full-speed USB device number 4 using xhci_hcd [140006.160938] usb 2-12: reset high-speed USB device number 5 using xhci_hcd [140006.320745] OOM killer enabled. [140006.320748] Restarting tasks ... done. [140006.327551] random: crng reseeded on system resumption [140006.339319] PM: suspend exit [140006.353118] Bluetooth: hci0: Legacy ROM 2.5 revision 8.0 build 1 week 45 2013 [140006.353130] Bluetooth: hci0: Intel Bluetooth firmware file: intel/ibt-hw-37.7.10-fw-1.80.1.2d.d.bseq [140006.549106] Bluetooth: hci0: Intel BT fw patch 0x2a completed & activated [140006.598316] Bluetooth: MGMT ver 1.22