netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fb.com>
To: <netdev@vger.kernel.org>, <kernel-team@fb.com>,
	"David S . Miller" <davem@davemloft.net>
Subject: [PATCH net-next] loopback: clear pfmemalloc on outgoing skb's
Date: Wed, 1 Feb 2017 16:04:38 -0500	[thread overview]
Message-ID: <1485983078-2372-1-git-send-email-jbacik@fb.com> (raw)

I was seeing random disconnects while testing NBD over loopback.  This turned
out to be because NBD sets pfmemalloc on it's socket, however the receiving side
is a user space application so does not have pfmemalloc set on its socket.  This
means that sk_filter_trim_cap will simply drop this packet, under the assumption
that the other side will simply retransmit.  Well we do retransmit, and then the
packet is just dropped again for the same reason.  To keep this from happening
simply clear skb->pfmemalloc on transmit so that we don't drop the packet on the
receive side.

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 drivers/net/loopback.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 1e05b7c..13c9126 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -81,6 +81,13 @@ static netdev_tx_t loopback_xmit(struct sk_buff *skb,
 	 */
 	skb_dst_force(skb);
 
+	/* If our transmitter was a pfmemalloc socket we need to clear
+	 * pfmemalloc here, otherwise the receiving socket may not be
+	 * pfmemalloc, and if this is a tcp packet then it'll get dropped and
+	 * all traffic will halt.
+	 */
+	skb->pfmemalloc = false;
+
 	skb->protocol = eth_type_trans(skb, dev);
 
 	/* it's OK to use per_cpu_ptr() because BHs are off */
-- 
2.7.4

             reply	other threads:[~2017-02-01 21:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-01 21:04 Josef Bacik [this message]
2017-02-01 23:38 ` [PATCH net-next] loopback: clear pfmemalloc on outgoing skb's Eric Dumazet
2017-02-01 23:57   ` Eric Dumazet
2017-02-02  2:13     ` [PATCH net-next] net: remove useless pfmemalloc setting Eric Dumazet
2017-02-03  4:03       ` David Miller
2017-02-02  2:46   ` [PATCH net-next] loopback: clear pfmemalloc on outgoing skb's Eric Dumazet
2017-02-02 15:56   ` Josef Bacik
2017-02-02 17:06     ` Eric Dumazet
2017-02-02 20:49       ` Josef Bacik
2017-02-03  4:40 ` [PATCH net-next] tcp: clear pfmemalloc on outgoing skb Eric Dumazet
2017-02-03 21:24   ` David Miller

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=1485983078-2372-1-git-send-email-jbacik@fb.com \
    --to=jbacik@fb.com \
    --cc=davem@davemloft.net \
    --cc=kernel-team@fb.com \
    --cc=netdev@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).