lkml.org 
[lkml]   [2012]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH v3 8/7] pppoatm: fix missing wakeup in pppoatm_send()
From
Date
Now that we can return zero from pppoatm_send() for reasons *other* than
the queue being full, that means we can't depend on a subsequent call to
pppoatm_pop() waking the queue, and we might leave it stalled
indefinitely.

Fix this by immediately scheduling the wakeup tasklet. As documented
already elsewhere, the PPP channel's ->downl lock protects against the
wakeup happening too soon and effectively being missed.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
----
Untested.
With this sorted, Acked-By: David Woodhouse <David.Woodhouse@intel.com<
to the other seven. Thanks.

diff --git a/net/atm/pppoatm.c b/net/atm/pppoatm.c
index 7507c20..56ad541 100644
--- a/net/atm/pppoatm.c
+++ b/net/atm/pppoatm.c
@@ -283,11 +283,11 @@ static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb)
vcc = ATM_SKB(skb)->vcc;
bh_lock_sock(sk_atm(vcc));
if (sock_owned_by_user(sk_atm(vcc)))
- goto nospace;
+ goto nospace_sched_wakeup;
if (test_bit(ATM_VF_RELEASED, &vcc->flags)
- || test_bit(ATM_VF_CLOSE, &vcc->flags)
- || !test_bit(ATM_VF_READY, &vcc->flags))
- goto nospace;
+ || test_bit(ATM_VF_CLOSE, &vcc->flags)
+ || !test_bit(ATM_VF_READY, &vcc->flags))
+ goto nospace_sched_wakeup;

switch (pvcc->encaps) { /* LLC encapsulation needed */
case e_llc:
@@ -328,7 +328,17 @@ static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb)
? DROP_PACKET : 1;
bh_unlock_sock(sk_atm(vcc));
return ret;
-nospace:
+ nospace_sched_wakeup:
+ /* If we're returning zero for reasons *other* than the queue
+ * being full, then we need to ensure that a wakeup will
+ * happen and not just leave the channel stalled for ever.
+ * Just schedule the wakeup tasklet directly. As observed in
+ * pppoatm_pop(), it'll take the channel's ->downl lock which
+ * is also held by our caller, so it can't happen "too soon"
+ * and cause us to effectively miss a wakeup.
+ */
+ tasklet_schedule(&pvcc->wakeup_tasklet);
+ nospace:
bh_unlock_sock(sk_atm(vcc));
/*
* We don't have space to send this SKB now, but we might have
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation



[unhandled content-type:application/x-pkcs7-signature]
\
 
 \ /
  Last update: 2012-11-07 14:21    [W:0.165 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site