Re: [PATCH for-next 06/12] io_uring: add fixed file peeking function

Jens Axboe
2022-10-31T16:04:56Z

On 10/31/22 7:41 AM, Dylan Yudaken wrote:
> @@ -1849,17 +1866,14 @@ inline struct file *io_file_get_fixed(struct io_kiocb *req, int fd,
> unsigned long file_ptr;
>
> io_ring_submit_lock(ctx, issue_flags);
> -
> - if (unlikely((unsigned int)fd >= ctx->nr_user_files))
> - goto out;
> - fd = array_index_nospec(fd, ctx->nr_user_files);
> - file_ptr = io_fixed_file_slot(&ctx->file_table, fd)->file_ptr;
> + file_ptr = __io_file_peek_fixed(req, fd);
> file = (struct file *) (file_ptr & FFS_MASK);
> file_ptr &= ~FFS_MASK;
> /* mask in overlapping REQ_F and FFS bits */
> req->flags |= (file_ptr << REQ_F_SUPPORT_NOWAIT_BIT);
> io_req_set_rsrc_node(req, ctx, 0);
> -out:
> + WARN_ON_ONCE(file && !test_bit(fd, ctx->file_table.bitmap));
> +
> io_ring_submit_unlock(ctx, issue_flags);
> return file;
> }

Is this WARN_ON_ONCE() a leftover from being originally based on a tree
before:

commit 4d5059512d283dab7372d282c2fbd43c7f5a2456
Author: Pavel Begunkov <asml.silence@gmail.com>
Date: Sun Oct 16 21:30:49 2022 +0100

io_uring: kill hot path fixed file bitmap debug checks

got added? Seems not related to the changes here otherwise.

--
Jens Axboe