Skip to content

Commit 76cd979

Browse files
metze-sambaaxboe
authored andcommitted
io_uring: imply MSG_NOSIGNAL for send[msg]()/recv[msg]() calls
We never want to generate any SIGPIPE, -EPIPE only is much better. Signed-off-by: Stefan Metzmacher <[email protected]> Link: https://lore.kernel.org/r/38961085c3ec49fd21550c7788f214d1ff02d2d4.1615908477.git.metze@samba.org Signed-off-by: Jens Axboe <[email protected]>
1 parent b7f5a0b commit 76cd979

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fs/io_uring.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4384,7 +4384,7 @@ static int io_sendmsg(struct io_kiocb *req, unsigned int issue_flags)
43844384
kmsg = &iomsg;
43854385
}
43864386

4387-
flags = req->sr_msg.msg_flags;
4387+
flags = req->sr_msg.msg_flags | MSG_NOSIGNAL;
43884388
if (flags & MSG_DONTWAIT)
43894389
req->flags |= REQ_F_NOWAIT;
43904390
else if (issue_flags & IO_URING_F_NONBLOCK)
@@ -4428,7 +4428,7 @@ static int io_send(struct io_kiocb *req, unsigned int issue_flags)
44284428
msg.msg_controllen = 0;
44294429
msg.msg_namelen = 0;
44304430

4431-
flags = req->sr_msg.msg_flags;
4431+
flags = req->sr_msg.msg_flags | MSG_NOSIGNAL;
44324432
if (flags & MSG_DONTWAIT)
44334433
req->flags |= REQ_F_NOWAIT;
44344434
else if (issue_flags & IO_URING_F_NONBLOCK)
@@ -4618,7 +4618,7 @@ static int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags)
46184618
1, req->sr_msg.len);
46194619
}
46204620

4621-
flags = req->sr_msg.msg_flags;
4621+
flags = req->sr_msg.msg_flags | MSG_NOSIGNAL;
46224622
if (flags & MSG_DONTWAIT)
46234623
req->flags |= REQ_F_NOWAIT;
46244624
else if (force_nonblock)
@@ -4677,7 +4677,7 @@ static int io_recv(struct io_kiocb *req, unsigned int issue_flags)
46774677
msg.msg_iocb = NULL;
46784678
msg.msg_flags = 0;
46794679

4680-
flags = req->sr_msg.msg_flags;
4680+
flags = req->sr_msg.msg_flags | MSG_NOSIGNAL;
46814681
if (flags & MSG_DONTWAIT)
46824682
req->flags |= REQ_F_NOWAIT;
46834683
else if (force_nonblock)

0 commit comments

Comments
 (0)