Re: [PATCH] fs/io_uring: fix O_PATH fds in openat, openat2, statx
From: Jens Axboe
Date: Thu May 07 2020 - 14:58:57 EST
On 5/7/20 12:57 PM, Max Kellermann wrote:
> If an operation's flag `needs_file` is set, the function
> io_req_set_file() calls io_file_get() to obtain a `struct file*`.
>
> This fails for `O_PATH` file descriptors, because those have no
> `struct file*`, causing io_req_set_file() to throw `-EBADF`. This
> breaks the operations `openat`, `openat2` and `statx`, where `O_PATH`
> file descriptors are commonly used.
>
> The solution is to simply remove `needs_file` (and the accompanying
> flag `fd_non_reg`). This flag was never needed because those
> operations use numeric file descriptor and don't use the `struct
> file*` obtained by io_req_set_file().
Do you happen to have a liburing test addition for this as well?
--
Jens Axboe