diff options
author | Jens Axboe <axboe@kernel.dk> | 2019-12-11 19:29:43 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-01-20 17:01:53 -0700 |
commit | 0c9d5ccd26a004f59333c06fbbb98f9cb1eed93d (patch) | |
tree | 44cdf8ba1137666d0194c3fbe2d995d2138fa456 /fs/io_uring.c | |
parent | 6e802a4ba056a6f2f51ac9d54eead3ed6f9829a2 (diff) | |
download | lwn-0c9d5ccd26a004f59333c06fbbb98f9cb1eed93d.tar.gz lwn-0c9d5ccd26a004f59333c06fbbb98f9cb1eed93d.zip |
io-wq: add support for uncancellable work
Not all work can be cancelled, some of it we may need to guarantee
that it runs to completion. Allow the caller to set IO_WQ_WORK_NO_CANCEL
on work that must not be cancelled. Note that the caller work function
must also check for IO_WQ_WORK_NO_CANCEL on work that is marked
IO_WQ_WORK_CANCEL.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 34cbce622fcd..fe227650efd6 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3460,8 +3460,11 @@ static void io_wq_submit_work(struct io_wq_work **workptr) struct io_kiocb *nxt = NULL; int ret = 0; - if (work->flags & IO_WQ_WORK_CANCEL) + /* if NO_CANCEL is set, we must still run the work */ + if ((work->flags & (IO_WQ_WORK_CANCEL|IO_WQ_WORK_NO_CANCEL)) == + IO_WQ_WORK_CANCEL) { ret = -ECANCELED; + } if (!ret) { req->has_user = (work->flags & IO_WQ_WORK_HAS_MM) != 0; |