From 1a98214feef2221cd7c24b17cd688a5a9d85b2ea Mon Sep 17 00:00:00 2001 From: Rémi Denis-Courmont Date: Mon, 30 Aug 2010 12:57:03 +0000 Subject: Phonet: restore flow control credits when sending fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémi Denis-Courmont Signed-off-by: David S. Miller --- net/phonet/pep.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'net/phonet/pep.c') diff --git a/net/phonet/pep.c b/net/phonet/pep.c index b2a3ae6cad7..5034f0f62bd 100644 --- a/net/phonet/pep.c +++ b/net/phonet/pep.c @@ -834,6 +834,7 @@ static int pipe_skb_send(struct sock *sk, struct sk_buff *skb) { struct pep_sock *pn = pep_sk(sk); struct pnpipehdr *ph; + int err; if (pn_flow_safe(pn->tx_fc) && !atomic_add_unless(&pn->tx_credits, -1, 0)) { @@ -852,7 +853,10 @@ static int pipe_skb_send(struct sock *sk, struct sk_buff *skb) ph->message_id = PNS_PIPE_DATA; ph->pipe_handle = pn->pipe_handle; - return pn_skb_send(sk, skb, &pipe_srv); + err = pn_skb_send(sk, skb, &pipe_srv); + if (err && pn_flow_safe(pn->tx_fc)) + atomic_inc(&pn->tx_credits); + return err; } static int pep_sendmsg(struct kiocb *iocb, struct sock *sk, -- cgit v1.2.3