linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] fuse: do not generate interrupt requests for fatal signals
@ 2024-06-13  4:01 Haifeng Xu
  2024-06-13  7:55 ` Miklos Szeredi
  0 siblings, 1 reply; 13+ messages in thread
From: Haifeng Xu @ 2024-06-13  4:01 UTC (permalink / raw)
  To: miklos; +Cc: linux-fsdevel, linux-kernel, Haifeng Xu

When the child reaper of a pid namespace exits, it invokes
zap_pid_ns_processes() to send SIGKILL to all processes in the
namespace and wait them exit. But one of the child processes get
stuck and its call trace like this:

[<0>] request_wait_answer+0x132/0x210 [fuse]
[<0>] fuse_simple_request+0x1a8/0x2e0 [fuse]
[<0>] fuse_flush+0x193/0x1d0 [fuse]
[<0>] filp_close+0x34/0x70
[<0>] close_fd+0x38/0x50
[<0>] __x64_sys_close+0x12/0x40
[<0>] do_syscall_64+0x59/0xc0
[<0>] entry_SYSCALL_64_after_hwframe+0x44/0xae

The flags of fuse request is (FR_ISREPLY | FR_FORCE | FR_WAITING
| FR_INTERRUPTED | FR_SENT). For interrupt requests, fuse_dev_do_write()
doesn't invoke fuse_request_end() to wake the client thread, so it will
get stuck forever and the child reaper can't exit.

In order to write reply to the client thread and make it exit the
namespace, so do not generate interrupt requests for fatal signals.

Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
---
 fs/fuse/dev.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 9eb191b5c4de..5fb830ad860d 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -374,11 +374,14 @@ static void request_wait_answer(struct fuse_req *req)
 		if (!err)
 			return;
 
-		set_bit(FR_INTERRUPTED, &req->flags);
-		/* matches barrier in fuse_dev_do_read() */
-		smp_mb__after_atomic();
-		if (test_bit(FR_SENT, &req->flags))
-			queue_interrupt(req);
+		/* Any signal except fatal can generate an interrupt request */
+		if (!__fatal_signal_pending(current)) {
+			set_bit(FR_INTERRUPTED, &req->flags);
+			/* matches barrier in fuse_dev_do_read() */
+			smp_mb__after_atomic();
+			if (test_bit(FR_SENT, &req->flags))
+				queue_interrupt(req);
+		}
 	}
 
 	if (!test_bit(FR_FORCE, &req->flags)) {
-- 
2.25.1


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

end of thread, other threads:[~2024-08-27  8:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-13  4:01 [RFC] fuse: do not generate interrupt requests for fatal signals Haifeng Xu
2024-06-13  7:55 ` Miklos Szeredi
2024-06-13 10:44   ` Haifeng Xu
2024-06-14 10:01     ` Miklos Szeredi
2024-06-15 12:19       ` Haifeng Xu
2024-08-21 17:38         ` Bernd Schubert
2024-08-27  8:46           ` Haifeng Xu
2024-06-17  7:25       ` Christian Brauner
2024-06-20  6:43         ` Haifeng Xu
2024-06-20 21:40           ` Bernd Schubert
2024-06-21  2:36             ` Haifeng Xu
2024-06-14 10:31   ` Bernd Schubert
2024-06-15 12:20     ` Haifeng Xu

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).