]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ksmbd: sleep interruptibly in the durable handle scavenger
authorNamjae Jeon <linkinjeon@kernel.org>
Sun, 21 Jun 2026 10:59:56 +0000 (19:59 +0900)
committerSteve French <stfrench@microsoft.com>
Tue, 23 Jun 2026 01:15:06 +0000 (20:15 -0500)
The durable handle scavenger kthread waits up to DURABLE_HANDLE_MAX_TIMEOUT
(300 seconds) between scans using wait_event_timeout(), which sleeps in
TASK_UNINTERRUPTIBLE. When there are no durable handles pending expiry the
task stays in D state far longer than 120 seconds, so the hung task
detector prints a bogus "task ksmbd-durable-s blocked for more than 120
seconds" warning with a backtrace, even though the thread is only idle.

Use wait_event_interruptible_timeout() so the thread sleeps in
TASK_INTERRUPTIBLE, which the hung task detector ignores. This also suits
the already-freezable kthread. Treat a negative return (e.g. -ERESTARTSYS)
like a timeout when recomputing the next wake interval.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/server/vfs_cache.c

index 7495166b0262f2ceb789e0f418cbaeff83c8e290..fde22742d193b7211c1dd96637f1cfb2accfe8b8 100644 (file)
@@ -1344,10 +1344,10 @@ static int ksmbd_durable_scavenger(void *dummy)
                if (try_to_freeze())
                        continue;
 
-               remaining_jiffies = wait_event_timeout(dh_wq,
+               remaining_jiffies = wait_event_interruptible_timeout(dh_wq,
                                   ksmbd_durable_scavenger_alive() == false,
                                   __msecs_to_jiffies(min_timeout));
-               if (remaining_jiffies)
+               if ((long)remaining_jiffies > 0)
                        min_timeout = jiffies_to_msecs(remaining_jiffies);
                else
                        min_timeout = DURABLE_HANDLE_MAX_TIMEOUT;