io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] io-wq: exclusively gate signal based exit on get_signal() return
@ 2021-09-27 16:58 Jens Axboe
  2021-09-27 17:00 ` Eric W. Biederman
  0 siblings, 1 reply; 2+ messages in thread
From: Jens Axboe @ 2021-09-27 16:58 UTC (permalink / raw)
  To: io-uring; +Cc: Eric W. Biederman, Linus Torvalds

io-wq threads block all signals, except SIGKILL and SIGSTOP. We should not
need any extra checking of signal_pending or fatal_signal_pending, rely
exclusively on whether or not get_signal() tells us to exit.

The original debugging of this issue led to the false positive that we
were exiting on non-fatal signals, but that is not the case. The issue
was around races with nr_workers accounting.

Fixes: 87c169665578 ("io-wq: ensure we exit if thread group is exiting")
Fixes: 15e20db2e0ce ("io-wq: only exit on fatal signals")
Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

---

diff --git a/fs/io-wq.c b/fs/io-wq.c
index c2360cdc403d..5bf8aa81715e 100644
--- a/fs/io-wq.c
+++ b/fs/io-wq.c
@@ -584,10 +584,7 @@ static int io_wqe_worker(void *data)
 
 			if (!get_signal(&ksig))
 				continue;
-			if (fatal_signal_pending(current) ||
-			    signal_group_exit(current->signal))
-				break;
-			continue;
+			break;
 		}
 		last_timeout = !ret;
 	}

-- 
Jens Axboe


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

* Re: [PATCH] io-wq: exclusively gate signal based exit on get_signal() return
  2021-09-27 16:58 [PATCH] io-wq: exclusively gate signal based exit on get_signal() return Jens Axboe
@ 2021-09-27 17:00 ` Eric W. Biederman
  0 siblings, 0 replies; 2+ messages in thread
From: Eric W. Biederman @ 2021-09-27 17:00 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring, Linus Torvalds

Jens Axboe <axboe@kernel.dk> writes:

> io-wq threads block all signals, except SIGKILL and SIGSTOP. We should not
> need any extra checking of signal_pending or fatal_signal_pending, rely
> exclusively on whether or not get_signal() tells us to exit.
>
> The original debugging of this issue led to the false positive that we
> were exiting on non-fatal signals, but that is not the case. The issue
> was around races with nr_workers accounting.

Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>

>
> Fixes: 87c169665578 ("io-wq: ensure we exit if thread group is exiting")
> Fixes: 15e20db2e0ce ("io-wq: only exit on fatal signals")
> Reported-by: Eric W. Biederman <ebiederm@xmission.com>
> Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>
> ---
>
> diff --git a/fs/io-wq.c b/fs/io-wq.c
> index c2360cdc403d..5bf8aa81715e 100644
> --- a/fs/io-wq.c
> +++ b/fs/io-wq.c
> @@ -584,10 +584,7 @@ static int io_wqe_worker(void *data)
>  
>  			if (!get_signal(&ksig))
>  				continue;
> -			if (fatal_signal_pending(current) ||
> -			    signal_group_exit(current->signal))
> -				break;
> -			continue;
> +			break;
>  		}
>  		last_timeout = !ret;
>  	}

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

end of thread, other threads:[~2021-09-27 17:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-27 16:58 [PATCH] io-wq: exclusively gate signal based exit on get_signal() return Jens Axboe
2021-09-27 17:00 ` Eric W. Biederman

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