Skip to contentSkip to conversation

io-wq: exclusively gate signal based exit on get_signal() return

PATCH In review Jens Axboe 2 participants 2 messages Sep 27, 2021

Subsystems (2)
lore
Share & tools
lore

Jens Axboe

author maintainer
#0 lore raw

PATCH 1/1 io-wq: exclusively gate signal based exit on get_signal() return

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

---

fs/io-wq.c +1 -4
index c2360cdc403d..5bf8aa81715e 100644
@@ -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;
 	}
Signature · 1 line
Jens Axboe
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jens Axboe

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.

Quoted 25 lines
Fixes 87c169665578 ("io-wq: ensure we exit if thread group is exiting")
Fixes 15e20db2e0ce ("io-wq: only exit on fatal signals")

---

fs/io-wq.c +1 -4
index c2360cdc403d..5bf8aa81715e 100644
@@ -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;
 	}