Skip to content

Commit a196c78

Browse files
committed
io_uring: assign non-fixed early for async work
We defer file assignment to ensure that fixed files work with links between a direct accept/open and the links that follow it. But this has the side effect that normal file assignment is then not complete by the time that request submission has been done. For deferred execution, if the file is a regular file, assign it when we do the async prep anyway. Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 303cc74 commit a196c78

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

fs/io_uring.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6947,7 +6947,12 @@ static int io_req_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
69476947

69486948
static int io_req_prep_async(struct io_kiocb *req)
69496949
{
6950-
if (!io_op_defs[req->opcode].needs_async_setup)
6950+
const struct io_op_def *def = &io_op_defs[req->opcode];
6951+
6952+
/* assign early for deferred execution for non-fixed file */
6953+
if (def->needs_file && !(req->flags & REQ_F_FIXED_FILE))
6954+
req->file = io_file_get_normal(req, req->fd);
6955+
if (!def->needs_async_setup)
69516956
return 0;
69526957
if (WARN_ON_ONCE(req_has_async_data(req)))
69536958
return -EFAULT;

0 commit comments

Comments
 (0)