mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 22:02:02 +00:00
io_uring/unix: drop usage of io_uring socket
Commit a4104821ad
upstream.
Since we no longer allow sending io_uring fds over SCM_RIGHTS, move to
using io_is_uring_fops() to detect whether this is a io_uring fd or not.
With that done, kill off io_uring_get_socket() as nobody calls it
anymore.
This is in preparation to yanking out the rest of the core related to
unix gc with io_uring.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
db324cbb75
commit
f3ee556f30
5 changed files with 7 additions and 22 deletions
|
@ -93,6 +93,7 @@ int io_uring_cmd_sock(struct io_uring_cmd *cmd, unsigned int issue_flags);
|
||||||
void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd,
|
void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd,
|
||||||
unsigned int issue_flags);
|
unsigned int issue_flags);
|
||||||
struct task_struct *io_uring_cmd_get_task(struct io_uring_cmd *cmd);
|
struct task_struct *io_uring_cmd_get_task(struct io_uring_cmd *cmd);
|
||||||
|
bool io_is_uring_fops(struct file *file);
|
||||||
#else
|
#else
|
||||||
static inline int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,
|
static inline int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,
|
||||||
struct iov_iter *iter, void *ioucmd)
|
struct iov_iter *iter, void *ioucmd)
|
||||||
|
@ -111,10 +112,6 @@ static inline void io_uring_cmd_do_in_task_lazy(struct io_uring_cmd *ioucmd,
|
||||||
void (*task_work_cb)(struct io_uring_cmd *, unsigned))
|
void (*task_work_cb)(struct io_uring_cmd *, unsigned))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
static inline struct sock *io_uring_get_socket(struct file *file)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
static inline void io_uring_task_cancel(void)
|
static inline void io_uring_task_cancel(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -141,6 +138,10 @@ static inline struct task_struct *io_uring_cmd_get_task(struct io_uring_cmd *cmd
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
static inline bool io_is_uring_fops(struct file *file)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -177,19 +177,6 @@ static struct ctl_table kernel_io_uring_disabled_table[] = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct sock *io_uring_get_socket(struct file *file)
|
|
||||||
{
|
|
||||||
#if defined(CONFIG_UNIX)
|
|
||||||
if (io_is_uring_fops(file)) {
|
|
||||||
struct io_ring_ctx *ctx = file->private_data;
|
|
||||||
|
|
||||||
return ctx->ring_sock->sk;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(io_uring_get_socket);
|
|
||||||
|
|
||||||
static inline void io_submit_flush_completions(struct io_ring_ctx *ctx)
|
static inline void io_submit_flush_completions(struct io_ring_ctx *ctx)
|
||||||
{
|
{
|
||||||
if (!wq_list_empty(&ctx->submit_state.compl_reqs) ||
|
if (!wq_list_empty(&ctx->submit_state.compl_reqs) ||
|
||||||
|
|
|
@ -61,7 +61,6 @@ struct file *io_file_get_fixed(struct io_kiocb *req, int fd,
|
||||||
unsigned issue_flags);
|
unsigned issue_flags);
|
||||||
|
|
||||||
void __io_req_task_work_add(struct io_kiocb *req, unsigned flags);
|
void __io_req_task_work_add(struct io_kiocb *req, unsigned flags);
|
||||||
bool io_is_uring_fops(struct file *file);
|
|
||||||
bool io_alloc_async_data(struct io_kiocb *req);
|
bool io_alloc_async_data(struct io_kiocb *req);
|
||||||
void io_req_task_queue(struct io_kiocb *req);
|
void io_req_task_queue(struct io_kiocb *req);
|
||||||
void io_queue_iowq(struct io_kiocb *req, struct io_tw_state *ts_dont_use);
|
void io_queue_iowq(struct io_kiocb *req, struct io_tw_state *ts_dont_use);
|
||||||
|
|
|
@ -105,7 +105,7 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp)
|
||||||
if (fd < 0 || !(file = fget_raw(fd)))
|
if (fd < 0 || !(file = fget_raw(fd)))
|
||||||
return -EBADF;
|
return -EBADF;
|
||||||
/* don't allow io_uring files */
|
/* don't allow io_uring files */
|
||||||
if (io_uring_get_socket(file)) {
|
if (io_is_uring_fops(file)) {
|
||||||
fput(file);
|
fput(file);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,10 +35,8 @@ struct sock *unix_get_socket(struct file *filp)
|
||||||
/* PF_UNIX ? */
|
/* PF_UNIX ? */
|
||||||
if (s && ops && ops->family == PF_UNIX)
|
if (s && ops && ops->family == PF_UNIX)
|
||||||
u_sock = s;
|
u_sock = s;
|
||||||
} else {
|
|
||||||
/* Could be an io_uring instance */
|
|
||||||
u_sock = io_uring_get_socket(filp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return u_sock;
|
return u_sock;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(unix_get_socket);
|
EXPORT_SYMBOL(unix_get_socket);
|
||||||
|
|
Loading…
Reference in a new issue