Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'io_uring-5.12-2021-04-09' of git://git.kernel.dk/linux-block

Pull io_uring fixes from Jens Axboe:
"Two minor fixups for the reissue logic, and one for making sure that
unbounded work is canceled on io-wq exit"

* tag 'io_uring-5.12-2021-04-09' of git://git.kernel.dk/linux-block:
io-wq: cancel unbounded works on io-wq destroy
io_uring: fix rw req completion
io_uring: clear F_REISSUE right after getting it

+21 -2
+4
fs/io-wq.c
··· 415 415 { 416 416 struct io_wqe *wqe = worker->wqe; 417 417 struct io_wq *wq = wqe->wq; 418 + bool do_kill = test_bit(IO_WQ_BIT_EXIT, &wq->state); 418 419 419 420 do { 420 421 struct io_wq_work *work; ··· 445 444 unsigned int hash = io_get_work_hash(work); 446 445 447 446 next_hashed = wq_next_work(work); 447 + 448 + if (unlikely(do_kill) && (work->flags & IO_WQ_WORK_UNBOUND)) 449 + work->flags |= IO_WQ_WORK_CANCEL; 448 450 wq->do_work(work); 449 451 io_assign_current_work(worker, NULL); 450 452
+17 -2
fs/io_uring.c
··· 2762 2762 { 2763 2763 struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw.kiocb); 2764 2764 struct io_async_rw *io = req->async_data; 2765 + bool check_reissue = kiocb->ki_complete == io_complete_rw; 2765 2766 2766 2767 /* add previously done IO, if any */ 2767 2768 if (io && io->bytes_done > 0) { ··· 2778 2777 __io_complete_rw(req, ret, 0, issue_flags); 2779 2778 else 2780 2779 io_rw_done(kiocb, ret); 2780 + 2781 + if (check_reissue && req->flags & REQ_F_REISSUE) { 2782 + req->flags &= ~REQ_F_REISSUE; 2783 + if (!io_rw_reissue(req)) { 2784 + int cflags = 0; 2785 + 2786 + req_set_fail_links(req); 2787 + if (req->flags & REQ_F_BUFFER_SELECTED) 2788 + cflags = io_put_rw_kbuf(req); 2789 + __io_req_complete(req, issue_flags, ret, cflags); 2790 + } 2791 + } 2781 2792 } 2782 2793 2783 2794 static int io_import_fixed(struct io_kiocb *req, int rw, struct iov_iter *iter) ··· 3307 3294 ret = io_iter_do_read(req, iter); 3308 3295 3309 3296 if (ret == -EAGAIN || (req->flags & REQ_F_REISSUE)) { 3297 + req->flags &= ~REQ_F_REISSUE; 3310 3298 /* IOPOLL retry should happen for io-wq threads */ 3311 3299 if (!force_nonblock && !(req->ctx->flags & IORING_SETUP_IOPOLL)) 3312 3300 goto done; ··· 3431 3417 else 3432 3418 ret2 = -EINVAL; 3433 3419 3434 - if (req->flags & REQ_F_REISSUE) 3420 + if (req->flags & REQ_F_REISSUE) { 3421 + req->flags &= ~REQ_F_REISSUE; 3435 3422 ret2 = -EAGAIN; 3423 + } 3436 3424 3437 3425 /* 3438 3426 * Raw bdev writes will return -EOPNOTSUPP for IOCB_NOWAIT. Just ··· 6189 6173 ret = -ECANCELED; 6190 6174 6191 6175 if (!ret) { 6192 - req->flags &= ~REQ_F_REISSUE; 6193 6176 do { 6194 6177 ret = io_issue_sqe(req, 0); 6195 6178 /*