From 4a013e3dd84f364fcc181a5ca30db2944c32ed86 Mon Sep 17 00:00:00 2001 From: Yaroslav Furman Date: Sun, 7 Mar 2021 21:03:44 +0300 Subject: [PATCH] fuse: Don't wait forever in request_wait_answer() Waiting for too long causes errors like this: [ 2575.350286] Freezing of tasks aborted after 9.232 seconds [ 2575.352547] Orange:0 D 0 19940 695 0x00000809 [ 2575.352577] Call trace: [ 2575.352600] __switch_to+0x1c4/0x220 [ 2575.352610] __schedule.lto_priv.0+0x20c/0x6e0 [ 2575.352615] schedule+0x38/0x9c [ 2575.352626] __fuse_request_send+0x228/0x3c0 [ 2575.352629] fuse_simple_request+0xe0/0x1d4 [ 2575.352634] fuse_lookup_name+0x128/0x2a8 [ 2575.352638] fuse_lookup.lto_priv.0+0x10c/0x1c0 [ 2575.352648] lookup_slow+0xd0/0x2b0 [ 2575.352651] walk_component+0x248/0x9ac [ 2575.352655] path_lookupat.lto_priv.0+0x94/0x2e0 [ 2575.352664] SyS_faccessat+0x120/0x4cc [ 2575.352671] __sys_trace_return+0x0/0x4 Change-Id: Ie12ac4f7307c1c436ca589d1df33f5cf2b4c8778 Signed-off-by: Yaroslav Furman Signed-off-by: Richard Raya --- fs/fuse/dev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index a2c4ec39f4be..8aa7633dfbfc 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -479,11 +479,11 @@ static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req) /* * Either request is already in userspace, or it was forced. - * Wait it out. + * Wait half of freeze_timeout_msecs to avoid getting stuck. */ while (!test_bit(FR_FINISHED, &req->flags)) - wait_event_freezable(req->waitq, - test_bit(FR_FINISHED, &req->flags)); + wait_event_freezable_timeout(req->waitq, + test_bit(FR_FINISHED, &req->flags), freeze_timeout_msecs / 2); } static void __fuse_request_send(struct fuse_conn *fc, struct fuse_req *req)