History

io_uring: terminate manual loop iterator loop correctly for non-vecs

The fix for not advancing the iterator if we're using fixed buffers is broken in that it can hit a condition where we don't terminate the loop. This results in io-wq looping forever, asking to read (or write) 0 bytes for every subsequent loop.

Jens Axboe committed 4 years ago

Commit 5e929361 parent adf3a9e1 file · +4 −2Browse files

Unified · Split

fs/io_uring.c+4−2
@@ -3612,13 +3612,15 @@ static ssize_t loop_rw_iter(int rw, struct io_kiocb *req, struct iov_iter *iter) · 3611 unmodified lines
36123612 ret = nr;
36133613 break;
36143614 }
3615+ ret += nr;
36153616 if (!iov_iter_is_bvec(iter)) {
36163617 iov_iter_advance(iter, nr);
36173618 } else {
3618− req->rw.len -= nr;
36193619 req->rw.addr += nr;
3620+ req->rw.len -= nr;
3621+ if (!req->rw.len)
3622+ break;
36203623 }
3621− ret += nr;
36223624 if (nr != iovec.iov_len)
36233625 break;
36243626 }