Re: [f2fs-dev] [PATCH v2] f2fs: quiesce background threads during system suspend using PM notifier
From: Chao Yu
Date: Thu Aug 06 2026 - 19:47:33 EST
On 8/7/26 01:01, Daeho Jeong wrote:
From: Daeho Jeong <daehojeong@xxxxxxxxxx>
During system suspend, a race condition can cause f2fs_gc and f2fs_discard
threads to call submit_bio() while the underlying block device (e.g., UFS)
is in Runtime PM suspend. Because Runtime PM worker threads are already
frozen during task freezing, the threads become trapped in
__bio_queue_enter() waiting on mq_freeze_wq, leading to a PM freezer
timeout.
To prevent this deadlock, register a PM notifier to set SBI_IS_SUSPENDING
during PM_SUSPEND_PREPARE. Background GC and discard threads check this
flag and immediately stop issuing new bios, allowing them to enter a
freezable sleep state cleanly before process freezing begins.
In addition, check freezing() as a fast path to stop issuing new I/O
when non-PM freezing (e.g. dm-snapshot or cgroup freezer) is requested.
Signed-off-by: Daeho Jeong <daehojeong@xxxxxxxxxx>
Reviewed-by: Chao Yu <chao@xxxxxxxxxx>
Thanks,