Skip to content

Commit 2d141dd

Browse files
committed
io-wq: ensure work->task_pid is cleared on init
We use ->task_pid for exit cancellation, but we need to ensure it's cleared to zero for io_req_work_grab_env() to do the right thing. Take a suggestion from Bart and clear the whole thing, just setting the function passed in. This makes it more future proof as well. Fixes: 3628288 ("io-wq: add io_wq_cancel_pid() to cancel based on a specific pid") Signed-off-by: Jens Axboe <[email protected]>
1 parent 3030fd4 commit 2d141dd

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

fs/io-wq.h

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,10 @@ struct io_wq_work {
7979
pid_t task_pid;
8080
};
8181

82-
#define INIT_IO_WORK(work, _func) \
83-
do { \
84-
(work)->list.next = NULL; \
85-
(work)->func = _func; \
86-
(work)->files = NULL; \
87-
(work)->mm = NULL; \
88-
(work)->creds = NULL; \
89-
(work)->fs = NULL; \
90-
(work)->flags = 0; \
91-
} while (0) \
82+
#define INIT_IO_WORK(work, _func) \
83+
do { \
84+
*(work) = (struct io_wq_work){ .func = _func }; \
85+
} while (0) \
9286

9387
typedef void (get_work_fn)(struct io_wq_work *);
9488
typedef void (put_work_fn)(struct io_wq_work *);

0 commit comments

Comments
 (0)