1. 21 1月, 2020 4 次提交
  2. 17 1月, 2020 1 次提交
  3. 16 1月, 2020 2 次提交
  4. 15 1月, 2020 1 次提交
  5. 14 1月, 2020 1 次提交
  6. 08 1月, 2020 1 次提交
    • J
      io_uring: remove punt of short reads to async context · eacc6dfa
      Jens Axboe 提交于
      We currently punt any short read on a regular file to async context,
      but this fails if the short read is due to running into EOF. This is
      especially problematic since we only do the single prep for commands
      now, as we don't reset kiocb->ki_pos. This can result in a 4k read on
      a 1k file returning zero, as we detect the short read and then retry
      from async context. At the time of retry, the position is now 1k, and
      we end up reading nothing, and hence return 0.
      
      Instead of trying to patch around the fact that short reads can be
      legitimate and won't succeed in case of retry, remove the logic to punt
      a short read to async context. Simply return it.
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      eacc6dfa
  7. 21 12月, 2019 6 次提交
    • J
      io_uring: pass in 'sqe' to the prep handlers · 3529d8c2
      Jens Axboe 提交于
      This moves the prep handlers outside of the opcode handlers, and allows
      us to pass in the sqe directly. If the sqe is non-NULL, it means that
      the request should be prepared for the first time.
      
      With the opcode handlers not having access to the sqe at all, we are
      guaranteed that the prep handler has setup the request fully by the
      time we get there. As before, for opcodes that need to copy in more
      data then the io_kiocb allows for, the io_async_ctx holds that info. If
      a prep handler is invoked with req->io set, it must use that to retain
      information for later.
      
      Finally, we can remove io_kiocb->sqe as well.
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      3529d8c2
    • J
      io_uring: standardize the prep methods · 06b76d44
      Jens Axboe 提交于
      We currently have a mix of use cases. Most of the newer ones are pretty
      uniform, but we have some older ones that use different calling
      calling conventions. This is confusing.
      
      For the opcodes that currently rely on the req->io->sqe copy saving
      them from reuse, add a request type struct in the io_kiocb command
      union to store the data they need.
      
      Prepare for all opcodes having a standard prep method, so we can call
      it in a uniform fashion and outside of the opcode handler. This is in
      preparation for passing in the 'sqe' pointer, rather than storing it
      in the io_kiocb. Once we have uniform prep handlers, we can leave all
      the prep work to that part, and not even pass in the sqe to the opcode
      handler. This ensures that we don't reuse sqe data inadvertently.
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      06b76d44
    • J
      io_uring: read 'count' for IORING_OP_TIMEOUT in prep handler · 26a61679
      Jens Axboe 提交于
      Add the count field to struct io_timeout, and ensure the prep handler
      has read it. Timeout also needs an async context always, set it up
      in the prep handler if we don't have one.
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      26a61679
    • J
      io_uring: move all prep state for IORING_OP_{SEND,RECV}_MGS to prep handler · e47293fd
      Jens Axboe 提交于
      Add struct io_sr_msg in our io_kiocb per-command union, and ensure that
      the send/recvmsg prep handlers have grabbed what they need from the SQE
      by the time prep is done.
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      e47293fd
    • J
      io_uring: move all prep state for IORING_OP_CONNECT to prep handler · 3fbb51c1
      Jens Axboe 提交于
      Add struct io_connect in our io_kiocb per-command union, and ensure
      that io_connect_prep() has grabbed what it needs from the SQE.
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      3fbb51c1
    • J
      io_uring: add and use struct io_rw for read/writes · 9adbd45d
      Jens Axboe 提交于
      Put the kiocb in struct io_rw, and add the addr/len for the request as
      well. Use the kiocb->private field for the buffer index for fixed reads
      and writes.
      
      Any use of kiocb->ki_filp is flipped to req->file. It's the same thing,
      and less confusing.
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      9adbd45d
  8. 20 12月, 2019 1 次提交
  9. 19 12月, 2019 2 次提交
    • J
      io_uring: io_wq_submit_work() should not touch req->rw · fd6c2e4c
      Jens Axboe 提交于
      I've been chasing a weird and obscure crash that was userspace stack
      corruption, and finally narrowed it down to a bit flip that made a
      stack address invalid. io_wq_submit_work() unconditionally flips
      the req->rw.ki_flags IOCB_NOWAIT bit, but since it's a generic work
      handler, this isn't valid. Normal read/write operations own that
      part of the request, on other types it could be something else.
      
      Move the IOCB_NOWAIT clear to the read/write handlers where it belongs.
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      fd6c2e4c
    • P
      io_uring: don't wait when under-submitting · 7c504e65
      Pavel Begunkov 提交于
      There is no reliable way to submit and wait in a single syscall, as
      io_submit_sqes() may under-consume sqes (in case of an early error).
      Then it will wait for not-yet-submitted requests, deadlocking the user
      in most cases.
      
      Don't wait/poll if can't submit all sqes
      Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      7c504e65
  10. 18 12月, 2019 9 次提交
  11. 16 12月, 2019 2 次提交
  12. 12 12月, 2019 1 次提交
    • J
      io_uring: ensure we return -EINVAL on unknown opcode · 9e3aa61a
      Jens Axboe 提交于
      If we submit an unknown opcode and have fd == -1, io_op_needs_file()
      will return true as we default to needing a file. Then when we go and
      assign the file, we find the 'fd' invalid and return -EBADF. We really
      should be returning -EINVAL for that case, as we normally do for
      unsupported opcodes.
      
      Change io_op_needs_file() to have the following return values:
      
      0   - does not need a file
      1   - does need a file
      < 0 - error value
      
      and use this to pass back the right value for this invalid case.
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      9e3aa61a
  13. 11 12月, 2019 7 次提交
  14. 05 12月, 2019 2 次提交