]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
f2fs: fix to freeze GC and discard threads quickly
authorDaeho Jeong <daehojeong@google.com>
Mon, 16 Mar 2026 18:59:54 +0000 (11:59 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 2 Apr 2026 16:24:20 +0000 (16:24 +0000)
commit02d91398a602c394d72cd61a67c84e2730c5f79b
treeb845777adc18727eedb6e6d3bdf4bc5405748c84
parent7b9161a605e91d0987e2596a245dc1f21621b23f
f2fs: fix to freeze GC and discard threads quickly

Suspend can fail if kernel threads do not freeze for a while.
f2fs_gc and f2fs_discard threads can perform long-running operations
that prevent them from reaching a freeze point in a timely manner.

This patch adds explicit freezing checks in the following locations:
1. f2fs_gc: Added a check at the 'retry' label to exit the loop quickly
   if freezing is requested, especially during heavy GC rounds.
2. __issue_discard_cmd: Added a 'suspended' flag to break both inner and
   outer loops during discard command issuance if freezing is detected
   after at least one command has been issued.
3. __issue_discard_cmd_orderly: Added a similar check for orderly discard
   to ensure responsiveness.

These checks ensure that the threads release locks safely and enter the
frozen state.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/gc.c
fs/f2fs/segment.c