From: Hao Xu <howeyxu@xxxxxxxxxxx> In IORING_CLOSE_FD_AND_FILE_SLOT mode, we just stop and return error code if either of fixed or normal file close fails. But we can actually continue to do the close even one of them fails. What we need to do is put the two result in two place: for normal file close, put the result in cqe->res like the previous behaviour, while for fixed file close, put it in cqe->flags. Users should check both member to get the status of fixed and normal file close. Signed-off-by: Hao Xu <howeyxu@xxxxxxxxxxx> --- io_uring/openclose.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/io_uring/openclose.c b/io_uring/openclose.c index 4eb1f23e028a..da930081c03c 100644 --- a/io_uring/openclose.c +++ b/io_uring/openclose.c @@ -248,12 +248,15 @@ int io_close(struct io_kiocb *req, unsigned int issue_flags) struct io_close *close = io_kiocb_to_cmd(req); struct fdtable *fdt; struct file *file; - int ret; + int ret, ret2; if (close->file_slot) { ret = io_close_fixed(req, issue_flags); - if (ret || !(close->flags & IORING_CLOSE_FD_AND_FILE_SLOT)) + if (!(close->flags & IORING_CLOSE_FD_AND_FILE_SLOT)) goto err; + else + ret2 = ret; + } ret = -EBADF; @@ -286,6 +289,6 @@ int io_close(struct io_kiocb *req, unsigned int issue_flags) err: if (ret < 0) req_set_fail(req); - io_req_set_res(req, ret, 0); + io_req_set_res(req, ret, ret2); return IOU_OK; } -- 2.25.1