From 3b2e004494de3fa54fffaf220eeb1512cc49dada Mon Sep 17 00:00:00 2001 From: Chao Yu Date: Wed, 12 Jul 2023 04:08:05 +0800 Subject: [PATCH] UPSTREAM: f2fs: allow f2fs_ioc_{,de}compress_file to be interrupted This patch allows f2fs_ioc_{,de}compress_file() to be interrupted, so that, userspace won't be blocked when manual {,de}compression on large file is interrupted by signal. Bug: 325092012 Change-Id: I020026926732b184f227621cd64506dae92a00a1 Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim (cherry picked from commit 3a2c0e55f9bdeda9c3807d6ac23d62f027f6caa9) --- fs/f2fs/file.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index a82ad66e4664..c7d9778f3c1c 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -4185,6 +4185,12 @@ static int f2fs_ioc_decompress_file(struct file *filp) count -= len; page_idx += len; + + cond_resched(); + if (fatal_signal_pending(current)) { + ret = -EINTR; + break; + } } if (!ret) @@ -4259,6 +4265,12 @@ static int f2fs_ioc_compress_file(struct file *filp) count -= len; page_idx += len; + + cond_resched(); + if (fatal_signal_pending(current)) { + ret = -EINTR; + break; + } } if (!ret)