netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: Denys Fedoryshchenko <denys@visp.net.lb>
Cc: netdev@vger.kernel.org
Subject: Re: panic 2.6.27-rc3-git2, qdisc_dequeue_head
Date: Sat, 16 Aug 2008 11:13:32 +0200	[thread overview]
Message-ID: <20080816091332.GA3467@ami.dom.local> (raw)
In-Reply-To: <20080816085536.GA1737@ami.dom.local>

On Sat, Aug 16, 2008 at 10:55:37AM +0200, Jarek Poplawski wrote:
> On Fri, Aug 15, 2008 at 11:54:24PM +0300, Denys Fedoryshchenko wrote:
> > Btw, it can happen on deletion also. At that moment there was 600 sessions 
> > established(and non-stop logging in/off), and it is difficult to tell, what 
> > was happening at that moment...
> 
> Alas I can't find the reason, so here is some debugging patch (not tested!).

Hold on a minute! Forget the previous patch - here is a take #2.

Jarek P. 

---

 include/linux/skbuff.h  |   44 ++++++++++++++++++++++++++++++++------------
 net/sched/sch_generic.c |    1 +
 2 files changed, 33 insertions(+), 12 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 358661c..506142e 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -120,6 +120,7 @@ struct sk_buff_head {
 
 	__u32		qlen;
 	spinlock_t	lock;
+	spinlock_t	lock_debug;
 };
 
 struct sk_buff;
@@ -657,6 +658,7 @@ static inline __u32 skb_queue_len(const struct sk_buff_head *list_)
 static inline void skb_queue_head_init(struct sk_buff_head *list)
 {
 	spin_lock_init(&list->lock);
+	spin_lock_init(&list->lock_debug);
 	list->prev = list->next = (struct sk_buff *)list;
 	list->qlen = 0;
 }
@@ -679,10 +681,16 @@ static inline void __skb_insert(struct sk_buff *newsk,
 				struct sk_buff *prev, struct sk_buff *next,
 				struct sk_buff_head *list)
 {
-	newsk->next = next;
-	newsk->prev = prev;
-	next->prev  = prev->next = newsk;
-	list->qlen++;
+	if (spin_trylock(&list->lock_debug)) {
+		newsk->next = next;
+		newsk->prev = prev;
+		next->prev  = prev->next = newsk;
+		list->qlen++;
+		spin_unlock(&list->lock_debug);
+	} else {
+		kfree_skb(newsk);
+		WARN_ON(1);
+	}
 }
 
 /**
@@ -775,10 +783,16 @@ static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
 extern struct sk_buff *skb_dequeue(struct sk_buff_head *list);
 static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list)
 {
-	struct sk_buff *skb = skb_peek(list);
-	if (skb)
-		__skb_unlink(skb, list);
-	return skb;
+	if (spin_trylock(&list->lock_debug)) {
+		struct sk_buff *skb = skb_peek(list);
+		if (skb)
+			__skb_unlink(skb, list);
+		spin_unlock(&list->lock_debug);
+		return skb;
+	} else {
+		WARN_ON(1);
+		return NULL;
+	}
 }
 
 /**
@@ -792,10 +806,16 @@ static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list)
 extern struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list);
 static inline struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list)
 {
-	struct sk_buff *skb = skb_peek_tail(list);
-	if (skb)
-		__skb_unlink(skb, list);
-	return skb;
+	if (spin_trylock(&list->lock_debug)) {
+		struct sk_buff *skb = skb_peek_tail(list);
+		if (skb)
+			__skb_unlink(skb, list);
+		spin_unlock(&list->lock_debug);
+		return skb;
+	} else {
+		WARN_ON(1);
+		return NULL;
+	}
 }
 
 
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 4685746..bffe6cb 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -540,6 +540,7 @@ static void __qdisc_destroy(struct rcu_head *head)
 
 	kfree_skb(qdisc->gso_skb);
 
+	memset(qdisc, 0xf0 , sizeof(*qdisc));
 	kfree((char *) qdisc - qdisc->padded);
 }
 

  reply	other threads:[~2008-08-16  9:11 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-15 19:09 panic 2.6.27-rc3-git2, qdisc_dequeue_head Denys Fedoryshchenko
2008-08-15 20:16 ` Jarek Poplawski
2008-08-15 20:36   ` Denys Fedoryshchenko
2008-08-15 20:54     ` Denys Fedoryshchenko
2008-08-16  8:55       ` Jarek Poplawski
2008-08-16  9:13         ` Jarek Poplawski [this message]
2008-08-16 10:03           ` Denys Fedoryshchenko
2008-08-16 10:05             ` Denys Fedoryshchenko
2008-08-16 12:27               ` Jarek Poplawski
2008-08-16 12:24                 ` Denys Fedoryshchenko
2008-08-16 12:34                   ` Jarek Poplawski
2008-08-16 13:13                     ` Denys Fedoryshchenko
2008-08-16 14:27                       ` Jarek Poplawski
2008-08-16 15:28                         ` Denys Fedoryshchenko
2008-08-16 15:59                           ` Jarek Poplawski
2008-08-16 18:15                             ` Denys Fedoryshchenko
2008-08-16 18:52                               ` Jarek Poplawski
2008-08-16 19:22                                 ` Denys Fedoryshchenko
2008-08-16 19:47                                   ` Jarek Poplawski
2008-08-17  9:02                                     ` Denys Fedoryshchenko
2008-08-17  9:34                                       ` Jarek Poplawski
2008-08-17  9:35                                         ` Denys Fedoryshchenko
2008-08-17  9:52                                           ` Jarek Poplawski
2008-08-17 10:01                                             ` Denys Fedoryshchenko
2008-08-17 10:31                                               ` Jarek Poplawski
2008-08-17 10:55                                               ` Jarek Poplawski
2008-08-17 12:06                                                 ` Denys Fedoryshchenko
2008-08-17 12:18                                                   ` Denys Fedoryshchenko
2008-08-17 12:38                                                   ` Jarek Poplawski
2008-08-17 12:50                                                     ` Denys Fedoryshchenko
2008-08-17 13:03                                                       ` Denys Fedoryshchenko
2008-08-17 13:36                                                         ` Jarek Poplawski
2008-08-17 19:36                                                           ` Denys Fedoryshchenko
2008-08-17 21:47                                                             ` Jarek Poplawski
2008-08-17 22:02                                                               ` David Miller
2008-08-17 22:21                                                               ` Denys Fedoryshchenko
2008-08-17 22:32                                                                 ` Jarek Poplawski
2008-08-17 13:16                                                       ` Jarek Poplawski

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=20080816091332.GA3467@ami.dom.local \
    --to=jarkao2@gmail.com \
    --cc=denys@visp.net.lb \
    --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).