[Devel] [PATCH VZ10] fs/fuse kio: avoid hung-task warning on krpc_watcher
Liu Kui
kui.liu at virtuozzo.com
Fri Jun 5 12:18:36 MSK 2026
The indefinite wait_event() makes the watcher in TASK_UNINTERRUPTIBLE,
so a long-lived watched process triggers khungtaskd:
INFO: task krpc_watcher:225326 blocked for more than 1228 seconds.
Use wait_event_timeout() with a 60s period in a while-loop so the
task periodically reschedules and the warning goes away.
Signed-off-by: Liu Kui <kui.liu at virtuozzo.com>
---
fs/fuse/kio/pcs/pcs_krpc.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/kio/pcs/pcs_krpc.c b/fs/fuse/kio/pcs/pcs_krpc.c
index 7d5a9619276d..03ae995eaf55 100644
--- a/fs/fuse/kio/pcs/pcs_krpc.c
+++ b/fs/fuse/kio/pcs/pcs_krpc.c
@@ -665,12 +665,22 @@ static bool process_has_exited(struct pid *pid)
return exited;
}
+static inline bool krpc_watcher_should_stop(struct pid *watched_pid)
+{
+ return process_has_exited(watched_pid) || kthread_should_stop();
+}
+
static int krpc_watcher_fn(void *data)
{
struct pcs_krpc_set *krpcs = data;
+ struct pid *watched_pid = krpcs->watched_pid;
- wait_event(krpcs->watched_pid->wait_pidfd,
- process_has_exited(krpcs->watched_pid) || kthread_should_stop());
+ while (!krpc_watcher_should_stop(watched_pid)) {
+ /* Periodic wakeup so khungtaskd doesn't flag the watcher. */
+ wait_event_timeout(watched_pid->wait_pidfd,
+ krpc_watcher_should_stop(watched_pid),
+ 60 * HZ);
+ }
kthread_stop(krpcs->sender_task);
put_task_struct(krpcs->sender_task);
--
2.50.1 (Apple Git-155)
More information about the Devel
mailing list