io_uring: remove handler-local failing of negative results
Jens Axboe
maintainerPATCH 1/1 io_uring: remove handler-local failing of negative results
io_issue_sqe() now marks a request as failed if it completes with IOU_COMPLETE and a negative result. Drop the open-coded versions of that from the issue handlers.
Handlers that fail a request on something other than a negative result, may be issued through io_poll_issue() for multishot, or complete through task_work are left alone.
Signed-off-by Jens Axboe <[email protected]>
---
io_uring/advise.c +0 -2
@@ -101,8 +101,6 @@ int io_fadvise(struct io_kiocb *req, unsigned int issue_flags)WARN_ON_ONCE (issue_flags &IO_URING_F_NONBLOCK &&io_fadvise_force_async (fa)); ret =vfs_fadvise (req->file, fa->offset, fa->len, fa->advice); -if (ret <0 ) -req_set_fail (req);io_req_set_res (req, ret,0 );return IOU_COMPLETE ; }
io_uring/cancel.c +0 -2
@@ -262,8 +262,6 @@ int io_async_cancel(struct io_kiocb *req, unsigned int issue_flags) ret =__io_async_cancel (&cd, tctx, issue_flags); done: -if (ret <0 ) -req_set_fail (req);io_req_set_res (req, ret,0 );return IOU_COMPLETE ; }
io_uring/epoll.c +0 -4
@@ -69,8 +69,6 @@ int io_epoll_ctl(struct io_kiocb *req, unsigned int issue_flags)if (force_nonblock && ret == -EAGAIN )return -EAGAIN ; -if (ret <0 ) -req_set_fail (req);io_req_set_res (req, ret,0 );return IOU_COMPLETE ; }
@@ -95,8 +93,6 @@ int io_epoll_wait(struct io_kiocb *req, unsigned int issue_flags) ret =epoll_sendevents (req->file, iew->events, iew->maxevents);if (ret ==0 )return -EAGAIN ; -if (ret <0 ) -req_set_fail (req);io_req_set_res (req, ret,0 );return IOU_COMPLETE ;
io_uring/futex.c +1 -8
@@ -272,12 +272,9 @@ int io_futexv_wait(struct io_kiocb *req, unsigned int issue_flags) ret =futex_wait_multiple_setup (ifd->futexv, iof->futex_nr, &woken); -/* -* Error case, ret is < 0. Mark the request as failed. -*/ +/* Error case, the core marks the request as failed */ if (unlikely (ret <0 )) {io_ring_submit_unlock (ctx, issue_flags); -req_set_fail (req);io_req_set_res (req, ret,0 );io_req_async_data_free (req);return IOU_COMPLETE ;
@@ -358,8 +355,6 @@ int io_futex_wait(struct io_kiocb *req, unsigned int issue_flags) done_unlock:io_ring_submit_unlock (ctx, issue_flags); done: -if (ret <0 ) -req_set_fail (req);io_req_set_res (req, ret,0 );return IOU_COMPLETE ; }
@@ -375,8 +370,6 @@ int io_futex_wake(struct io_kiocb *req, unsigned int issue_flags)*/ ret =futex_wake (iof->uaddr,FLAGS_STRICT | iof->futex_flags,NULL , iof->futex_val, iof->futex_mask); -if (ret <0 ) -req_set_fail (req);io_req_set_res (req, ret,0 );return IOU_COMPLETE ; }
io_uring/kbuf.c +0 -2
@@ -623,8 +623,6 @@ int io_manage_buffers_legacy(struct io_kiocb *req, unsigned int issue_flags) ret =__io_manage_buffers_legacy (req, bl);io_ring_submit_unlock (ctx, issue_flags); -if (ret <0 ) -req_set_fail (req);io_req_set_res (req, ret,0 );return IOU_COMPLETE ; }
io_uring/msg_ring.c +2 -5
@@ -323,11 +323,8 @@ int io_msg_ring(struct io_kiocb *req, unsigned int issue_flags) } done: -if (ret <0 ) { -if (ret == -EAGAIN || ret ==IOU_ISSUE_SKIP_COMPLETE ) -return ret; -req_set_fail (req); - } +if (ret == -EAGAIN || ret ==IOU_ISSUE_SKIP_COMPLETE ) +return ret;io_req_set_res (req, ret,0 );return IOU_COMPLETE ; }
io_uring/net.c +2 -9
@@ -1824,7 +1824,6 @@ int io_socket(struct io_kiocb *req, unsigned int issue_flags)return -EAGAIN ;if (ret == -ERESTARTSYS ) ret = -EINTR ; -req_set_fail (req); }else if (!fixed) {fd_install (fd, file); ret = fd;
@@ -1910,8 +1909,6 @@ int io_connect(struct io_kiocb *req, unsigned int issue_flags)if (ret == -ERESTARTSYS ) ret = -EINTR ; out: -if (ret <0 ) -req_set_fail (req);io_req_set_res (req, ret,0 );return IOU_COMPLETE ; }
@@ -1970,10 +1967,8 @@ int io_bind(struct io_kiocb *req, unsigned int issue_flags)return -ENOTSOCK ; ret =__sys_bind_socket (sock, addr, bind->addr_len); -if (ret <0 ) -req_set_fail (req);io_req_set_res (req, ret,0 ); -return 0 ; +return IOU_COMPLETE ; }int io_listen_prep (struct io_kiocb *req,const struct io_uring_sqe *sqe)
@@ -1998,10 +1993,8 @@ int io_listen(struct io_kiocb *req, unsigned int issue_flags)return -ENOTSOCK ; ret =__sys_listen_socket (sock, listen->backlog); -if (ret <0 ) -req_set_fail (req);io_req_set_res (req, ret,0 ); -return 0 ; +return IOU_COMPLETE ; }void io_netmsg_cache_free (const void *entry)
io_uring/openclose.c +0 -6
@@ -179,8 +179,6 @@ int io_openat2(struct io_kiocb *req, unsigned int issue_flags) open->file_slot); err: req->flags &= ~REQ_F_NEED_CLEANUP ; -if (ret <0 ) -req_set_fail (req);io_req_set_res (req, ret,0 );return IOU_COMPLETE ; }
@@ -266,8 +264,6 @@ int io_close(struct io_kiocb *req, unsigned int issue_flags)/* No ->flush() or already async, safely close from here */ ret =filp_close (file, current->files); err: -if (ret <0 ) -req_set_fail (req);io_req_set_res (req, ret,0 );return IOU_COMPLETE ; }
@@ -309,8 +305,6 @@ int io_install_fixed_fd(struct io_kiocb *req, unsigned int issue_flags) ifi = io_kiocb_to_cmd(req, struct io_fixed_install); ret =receive_fd (req->file,NULL , ifi->o_flags); -if (ret <0 ) -req_set_fail (req);io_req_set_res (req, ret,0 );return IOU_COMPLETE ; }
io_uring/rsrc.c +0 -2
@@ -641,8 +641,6 @@ int io_files_update(struct io_kiocb *req, unsigned int issue_flags)io_ring_submit_unlock (ctx, issue_flags); } -if (ret <0 ) -req_set_fail (req);io_req_set_res (req, ret,0 );return IOU_COMPLETE ; }
io_uring/timeout.c +0 -2
@@ -591,8 +591,6 @@ int io_timeout_remove(struct io_kiocb *req, unsigned int issue_flags)raw_spin_unlock_irq (&ctx->timeout_lock); } -if (ret <0 ) -req_set_fail (req);io_req_set_res (req, ret,0 );return IOU_COMPLETE ; }
io_uring/waitid.c +0 -2
@@ -376,8 +376,6 @@ int io_waitid(struct io_kiocb *req, unsigned int issue_flags)io_ring_submit_unlock (ctx, issue_flags); done: -if (ret <0 ) -req_set_fail (req);io_req_set_res (req, ret,0 );return IOU_COMPLETE ; }
Signature · 1 line
Jens Axboe