io_uring: clear TIF_NOTIFY_SIGNAL if set and task_work not available
Changes
1 files changed · +7 −2
| File | Status | Add | Del | Content |
|---|---|---|---|---|
| io_uring/io_uring.h | modified | +7 | −2 | View file |
io_uring/io_uring.h
View filediff --git a/io_uring/io_uring.h b/io_uring/io_uring.h
index cef5ff9..50bc3af 100644
--- a/io_uring/io_uring.h
+++ b/io_uring/io_uring.h
@@ -238,9 +238,14 @@ static inline unsigned int io_sqring_entries(struct io_ring_ctx *ctx)
static inline int io_run_task_work(void)
{
+ /*
+ * Always check-and-clear the task_work notification signal. With how
+ * signaling works for task_work, we can find it set with nothing to
+ * run. We need to clear it for that case, like get_signal() does.
+ */
+ if (test_thread_flag(TIF_NOTIFY_SIGNAL))
+ clear_notify_signal();
if (task_work_pending(current)) {
- if (test_thread_flag(TIF_NOTIFY_SIGNAL))
- clear_notify_signal();
__set_current_state(TASK_RUNNING);
task_work_run();
return 1;