diff --git a/fs/io-wq.h b/fs/io-wq.h index 8cb345256f35038a707583b288430358042332b0..cc50754d028cc1b092799aa1ea27edc0d48cc9b5 100644 --- a/fs/io-wq.h +++ b/fs/io-wq.h @@ -62,4 +62,8 @@ static inline void io_wq_worker_running(struct task_struct *tsk) } #endif +static inline bool io_wq_current_is_worker(void) +{ + return in_task() && (current->flags & PF_IO_WORKER); +} #endif diff --git a/fs/io_uring.c b/fs/io_uring.c index ad534dcc65ab6445d893c90ee4096cacb12b2efa..b9061ec36cf3d956bcc7e9c4668fed094d33c99e 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -876,7 +876,7 @@ static void io_req_link_next(struct io_kiocb *req, struct io_kiocb **nxtptr) /* we dropped this link, get next */ nxt = list_first_entry_or_null(&req->link_list, struct io_kiocb, list); - } else if (nxtptr && current_work()) { + } else if (nxtptr && io_wq_current_is_worker()) { *nxtptr = nxt; break; } else {