diff options
author | Jens Axboe <axboe@kernel.dk> | 2020-02-25 19:52:56 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-02-25 21:23:48 +0100 |
commit | 2d141dd2caa78fbaf87b57c27769bdc14975ab3d (patch) | |
tree | 4aed9d6c4febd91e6ec7d4139937897140b58fd0 /fs/io-wq.h | |
parent | io-wq: remove spin-for-work optimization (diff) | |
download | linux-2d141dd2caa78fbaf87b57c27769bdc14975ab3d.tar.xz linux-2d141dd2caa78fbaf87b57c27769bdc14975ab3d.zip |
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: 36282881a795 ("io-wq: add io_wq_cancel_pid() to cancel based on a specific pid")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io-wq.h')
-rw-r--r-- | fs/io-wq.h | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/fs/io-wq.h b/fs/io-wq.h index ccc7d84af57d..33baba4370c5 100644 --- a/fs/io-wq.h +++ b/fs/io-wq.h @@ -79,16 +79,10 @@ struct io_wq_work { pid_t task_pid; }; -#define INIT_IO_WORK(work, _func) \ - do { \ - (work)->list.next = NULL; \ - (work)->func = _func; \ - (work)->files = NULL; \ - (work)->mm = NULL; \ - (work)->creds = NULL; \ - (work)->fs = NULL; \ - (work)->flags = 0; \ - } while (0) \ +#define INIT_IO_WORK(work, _func) \ + do { \ + *(work) = (struct io_wq_work){ .func = _func }; \ + } while (0) \ typedef void (get_work_fn)(struct io_wq_work *); typedef void (put_work_fn)(struct io_wq_work *); |