[PATCH] ext4: fix kthread_should_stop() while TASK_RUNNING
From: Pavel Skripkin
Date: Fri Aug 06 2021 - 03:40:31 EST
/* ... */
Signed-off-by: Pavel Skripkin <paskripkin@xxxxxxxxx>
---
fs/ext4/mmp.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c
index bc364c119af6..fd1985b79a8d 100644
--- a/fs/ext4/mmp.c
+++ b/fs/ext4/mmp.c
@@ -183,9 +183,15 @@ static int kmmpd(void *data)
}
diff = jiffies - last_update_time;
- if (diff < mmp_update_interval * HZ)
- schedule_timeout_interruptible(mmp_update_interval *
- HZ - diff);
+ if (diff < mmp_update_interval * HZ) {
+ set_current_state(TASK_INTERRUPTIBLE);
+ if (kthread_should_stop()) {
+ __set_current_state(TASK_RUNNING);
+ break;
+ }
+
+ schedule_timeout(mmp_update_interval * HZ - diff);
+ }
/*
* We need to make sure that more than mmp_check_interval
--
2.32.0
--------------79CCD88B29A58180385B73E4--