netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sabrina Dubroca <sd@queasysnail.net>
To: netdev@vger.kernel.org
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	Sabrina Dubroca <sd@queasysnail.net>
Subject: [PATCH ipsec-next 2/7] skbuff: Avoid sleeping in skb_send_sock_locked
Date: Wed, 21 Aug 2019 23:46:20 +0200	[thread overview]
Message-ID: <8a35b931932ed65b88cbb01e278973029b504cd7.1566395202.git.sd@queasysnail.net> (raw)
In-Reply-To: <cover.1566395202.git.sd@queasysnail.net>

From: Herbert Xu <herbert@gondor.apana.org.au>

For a function that needs to be called with the socket spinlock
held, sleeping would seem to be a bad idea.  This function does
in fact avoid sleeping when calling kernel_sendpage_locked on the
page part of the skb.  However, it doesn't do that when sending
the linear part.  Resulting in sleeping when the socket send buffer
is full.

This patch fixes it by setting the MSG_DONTWAIT flag when calling
kernel_sendmsg_locked.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
 net/core/skbuff.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index b50a5e3ac4e4..f863c7ef417c 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2367,6 +2367,7 @@ int skb_send_sock_locked(struct sock *sk, struct sk_buff *skb, int offset,
 		kv.iov_base = skb->data + offset;
 		kv.iov_len = slen;
 		memset(&msg, 0, sizeof(msg));
+		msg.msg_flags = MSG_DONTWAIT;
 
 		ret = kernel_sendmsg_locked(sk, &msg, &kv, 1, slen);
 		if (ret <= 0)
-- 
2.22.0


  parent reply	other threads:[~2019-08-21 21:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-21 21:46 [PATCH ipsec-next 0/7] ipsec: add TCP encapsulation support (RFC 8229) Sabrina Dubroca
2019-08-21 21:46 ` [PATCH ipsec-next 1/7] net: add queue argument to __skb_wait_for_more_packets and __skb_{,try_}recv_datagram Sabrina Dubroca
2019-08-23  2:39   ` kbuild test robot
2019-08-21 21:46 ` Sabrina Dubroca [this message]
2019-08-21 21:46 ` [PATCH ipsec-next 3/7] xfrm: introduce xfrm_trans_queue_net Sabrina Dubroca
2019-08-21 21:46 ` [PATCH ipsec-next 4/7] xfrm: add route lookup to xfrm4_rcv_encap Sabrina Dubroca
2019-08-21 21:46 ` [PATCH ipsec-next 5/7] esp4: prepare esp_input_done2 for non-UDP encapsulation Sabrina Dubroca
2019-08-21 21:46 ` [PATCH ipsec-next 6/7] esp4: split esp_output_udp_encap and introduce esp_output_encap Sabrina Dubroca
2019-08-21 21:46 ` [PATCH ipsec-next 7/7] xfrm: add espintcp (RFC 8229) Sabrina Dubroca
2019-08-29  7:04   ` Steffen Klassert
2019-08-29 12:34     ` Sabrina Dubroca
2019-08-23 23:17 ` [PATCH ipsec-next 0/7] ipsec: add TCP encapsulation support " Carl-Daniel Hailfinger

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=8a35b931932ed65b88cbb01e278973029b504cd7.1566395202.git.sd@queasysnail.net \
    --to=sd@queasysnail.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    /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).