提交 a44f9077 编写于 作者: J Jens Axboe 提交者: Joseph Qi

io_uring: use the proper helpers for io_send/recv

to #26323588

commit 0b7b21e42ba2d6ac9595a4358a9354249605a3af upstream.

Don't use the recvmsg/sendmsg helpers, use the same helpers that the
recv(2) and send(2) system calls use.
Reported-by: N李通洲 <carter.li@eoitek.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Acked-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
上级 0c6f7422
...@@ -3087,7 +3087,8 @@ static int io_send(struct io_kiocb *req, struct io_kiocb **nxt, ...@@ -3087,7 +3087,8 @@ static int io_send(struct io_kiocb *req, struct io_kiocb **nxt,
else if (force_nonblock) else if (force_nonblock)
flags |= MSG_DONTWAIT; flags |= MSG_DONTWAIT;
ret = __sys_sendmsg_sock(sock, &msg, flags); msg.msg_flags = flags;
ret = sock_sendmsg(sock, &msg);
if (force_nonblock && ret == -EAGAIN) if (force_nonblock && ret == -EAGAIN)
return -EAGAIN; return -EAGAIN;
if (ret == -ERESTARTSYS) if (ret == -ERESTARTSYS)
...@@ -3113,6 +3114,7 @@ static int io_recvmsg_prep(struct io_kiocb *req, ...@@ -3113,6 +3114,7 @@ static int io_recvmsg_prep(struct io_kiocb *req,
sr->msg_flags = READ_ONCE(sqe->msg_flags); sr->msg_flags = READ_ONCE(sqe->msg_flags);
sr->msg = u64_to_user_ptr(READ_ONCE(sqe->addr)); sr->msg = u64_to_user_ptr(READ_ONCE(sqe->addr));
sr->len = READ_ONCE(sqe->len);
if (!io || req->opcode == IORING_OP_RECV) if (!io || req->opcode == IORING_OP_RECV)
return 0; return 0;
...@@ -3231,7 +3233,7 @@ static int io_recv(struct io_kiocb *req, struct io_kiocb **nxt, ...@@ -3231,7 +3233,7 @@ static int io_recv(struct io_kiocb *req, struct io_kiocb **nxt,
else if (force_nonblock) else if (force_nonblock)
flags |= MSG_DONTWAIT; flags |= MSG_DONTWAIT;
ret = __sys_recvmsg_sock(sock, &msg, NULL, NULL, flags); ret = sock_recvmsg(sock, &msg, flags);
if (force_nonblock && ret == -EAGAIN) if (force_nonblock && ret == -EAGAIN)
return -EAGAIN; return -EAGAIN;
if (ret == -ERESTARTSYS) if (ret == -ERESTARTSYS)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册