io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Metzmacher <metze@samba.org>
To: io-uring@vger.kernel.org
Cc: Stefan Metzmacher <metze@samba.org>, stable@vger.kernel.org
Subject: [PATCH 2/2] io_uring: imply MSG_NOSIGNAL for send[msg]()/recv[msg]() calls
Date: Tue, 16 Mar 2021 16:33:27 +0100	[thread overview]
Message-ID: <38961085c3ec49fd21550c7788f214d1ff02d2d4.1615908477.git.metze@samba.org> (raw)
In-Reply-To: <cover.1615908477.git.metze@samba.org>

We never want to generate any SIGPIPE, -EPIPE only is much better.

cc: stable@vger.kernel.org
Signed-off-by: Stefan Metzmacher <metze@samba.org>
---
 fs/io_uring.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index f8a6a629e4db..54105c5cf9e8 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -4369,7 +4369,7 @@ static int io_sendmsg(struct io_kiocb *req, unsigned int issue_flags)
 		kmsg = &iomsg;
 	}
 
-	flags = req->sr_msg.msg_flags;
+	flags = req->sr_msg.msg_flags | MSG_NOSIGNAL;
 	if (flags & MSG_DONTWAIT)
 		req->flags |= REQ_F_NOWAIT;
 	else if (issue_flags & IO_URING_F_NONBLOCK)
@@ -4416,7 +4416,7 @@ static int io_send(struct io_kiocb *req, unsigned int issue_flags)
 	msg.msg_controllen = 0;
 	msg.msg_namelen = 0;
 
-	flags = req->sr_msg.msg_flags;
+	flags = req->sr_msg.msg_flags | MSG_NOSIGNAL;
 	if (flags & MSG_DONTWAIT)
 		req->flags |= REQ_F_NOWAIT;
 	else if (issue_flags & IO_URING_F_NONBLOCK)
@@ -4607,7 +4607,7 @@ static int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags)
 				1, req->sr_msg.len);
 	}
 
-	flags = req->sr_msg.msg_flags;
+	flags = req->sr_msg.msg_flags | MSG_NOSIGNAL;
 	if (flags & MSG_DONTWAIT)
 		req->flags |= REQ_F_NOWAIT;
 	else if (force_nonblock)
@@ -4669,7 +4669,7 @@ static int io_recv(struct io_kiocb *req, unsigned int issue_flags)
 	msg.msg_iocb = NULL;
 	msg.msg_flags = 0;
 
-	flags = req->sr_msg.msg_flags;
+	flags = req->sr_msg.msg_flags | MSG_NOSIGNAL;
 	if (flags & MSG_DONTWAIT)
 		req->flags |= REQ_F_NOWAIT;
 	else if (force_nonblock)
-- 
2.25.1


  parent reply	other threads:[~2021-03-16 15:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16 15:33 [PATCH 0/2] send[msg]()/recv[msg]() fixes/improvements Stefan Metzmacher
2021-03-16 15:33 ` [PATCH 1/2] io_uring: call req_set_fail_links() on short send[msg]()/recv[msg]() calls Stefan Metzmacher
2021-03-20 19:33   ` [PATCH v2 1/1] io_uring: call req_set_fail_links() on short send[msg]()/recv[msg]() with MSG_WAITALL Stefan Metzmacher
2021-03-20 22:57     ` Jens Axboe
2021-03-21 10:20       ` Stefan Metzmacher
2021-03-21 13:10         ` Jens Axboe
2021-03-16 15:33 ` Stefan Metzmacher [this message]
2021-03-17 22:36 ` [PATCH 0/2] send[msg]()/recv[msg]() fixes/improvements Jens Axboe
2021-03-17 23:07   ` Pavel Begunkov
2021-03-17 23:24     ` Jens Axboe
2021-03-17 23:26     ` Stefan Metzmacher
2021-03-17 23:39       ` Pavel Begunkov
2021-03-18  0:15         ` Stefan Metzmacher
2021-03-18 13:00           ` Pavel Begunkov
2021-03-18 13:08           ` Pavel Begunkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=38961085c3ec49fd21550c7788f214d1ff02d2d4.1615908477.git.metze@samba.org \
    --to=metze@samba.org \
    --cc=io-uring@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).