linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fuse: fix unfreezable tasks
@ 2021-06-18 19:45 Sergey Shtylyov
  2021-06-21  9:05 ` Miklos Szeredi
  0 siblings, 1 reply; 2+ messages in thread
From: Sergey Shtylyov @ 2021-06-18 19:45 UTC (permalink / raw)
  To: Miklos Szeredi, linux-fsdevel; +Cc: Ildar Kamaletdinov

From: Ildar Kamaletdinov <i.kamaletdinov@omp.ru>

It could be impossible to freeze the fuse task in request_wait_answer()
when it calls wait_event_killable() with the FR_FINISHED flag because
the fuse daemon could be frozen before the task, so it simply can't
finish a request. E.g. it could be impossible to freeze while doing
poll() on a fuse FS:

[   90.468003] (0)[]Freezing of tasks aborted after 6.507 seconds
[   90.468793] (0)[1649:kworker/u8:18]qtaround::mt::A D
[   90.468830]    0  1590   1102 0x00400009
[   90.468850] (0)[1649:kworker/u8:18]Call trace:
[   90.468887] (0)[1649:kworker/u8:18][<ffffff82a7685a44>] __switch_to+0xd8/0xf4
[   90.468929] (0)[1649:kworker/u8:18][<ffffff82a851fa9c>] __schedule+0x75c/0x964
[   90.468964] (0)[1649:kworker/u8:18][<ffffff82a851fd14>] schedule+0x70/0x90
[   90.468995] (0)[1649:kworker/u8:18][<ffffff82a79fec00>] __fuse_request_send+0x228/0x3a4
[   90.469031] (0)[1649:kworker/u8:18][<ffffff82a79feeec>] fuse_simple_request+0x170/0x1c4
[   90.469068] (0)[1649:kworker/u8:18][<ffffff82a7a070e0>] fuse_file_poll+0x164/0x1c8
[   90.469107] (0)[1649:kworker/u8:18][<ffffff82a7851050>] do_sys_poll+0x2f4/0x5a0
[   90.469142] (0)[1649:kworker/u8:18][<ffffff82a78518f4>] do_restart_poll+0x4c/0x90
[   90.469178] (0)[1649:kworker/u8:18][<ffffff82a76bb32c>] sys_restart_syscall+0x18/0x20
[   90.469213] (0)[1649:kworker/u8:18][<ffffff82a76835c0>] el0_svc_naked+0x34/0x38
[   90.469457] (3)[647:dsme-server]Restarting tasks ...

Use freezer_do_not_count() to tell freezer to ignore the task while it
waits for event.

[Sergey: added #include <linux/freezer.h>, cleaned up the patch description]

Link: https://bugzilla.kernel.org/show_bug.cgi?id=198879
Fixes: 7d3a07fcb8a0 (fuse: don't mess with blocking signals)
Signed-off-by: Ildar Kamaletdinov <i.kamaletdinov@omp.ru>
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

---
This patch is against the Linus' repo -- I didn't find a tag suitable for
the fixes in Miklos Szeredi's FUSE repo. :-(

 fs/fuse/dev.c |    3 +++
 1 file changed, 3 insertions(+)

Index: linux/fs/fuse/dev.c
===================================================================
--- linux.orig/fs/fuse/dev.c
+++ linux/fs/fuse/dev.c
@@ -8,6 +8,7 @@
 
 #include "fuse_i.h"
 
+#include <linux/freezer.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/poll.h>
@@ -386,9 +387,11 @@ static void request_wait_answer(struct f
 	}
 
 	if (!test_bit(FR_FORCE, &req->flags)) {
+		freezer_do_not_count();
 		/* Only fatal signals may interrupt this */
 		err = wait_event_killable(req->waitq,
 					test_bit(FR_FINISHED, &req->flags));
+		freezer_count();
 		if (!err)
 			return;
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-21  9:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18 19:45 [PATCH] fuse: fix unfreezable tasks Sergey Shtylyov
2021-06-21  9:05 ` Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).